*data-readers* reset on clojure.core require


Requiring clojure.core overwrites the value of data-readers, which suggests that namespace is being reevaluated despite already being implicitly loaded when Clojure boots.

I cannot reproduce this behavior with namespaces I've written, which leads me to believe that this might stem from special treatment of clojure.core. ClojureJVM handles data-readers differently (alter-var-root seems to have no effect) and I was not able to reproduce this defect there.




David Miller
April 1, 2018, 8:10 PM

On ClojureCLR directly,

Clojure 1.9.0-master-SNAPSHOT
user=> data-readers
user=> (alter-var-root #'data-readers assoc :foo 99)
{:foo 99}
user=> data-readers

As Kevin points out, the likely issue is whether clojure.main is in the middle. clojure.main's repl explicitly establishes a binding for data-readers:

(binding [ns ns
warn-on-reflection warn-on-reflection
math-context math-context
print-meta print-meta
print-length print-length
print-level print-level
print-namespace-maps true
data-readers data-readers
default-data-reader-fn default-data-reader-fn


I think there is nothing to be done here.

Kevin Downey
November 13, 2017, 8:54 PM

the above is from using the clojure.main repl, so that could be different from running under nrepl

Kevin Downey
November 13, 2017, 8:52 PM

I am not sure about ClojureCLR but on the jvm this is the result of the repl binding data-readers

Your pinned fields
Click on the next to a field label to start pinning.


David Miller


Ramsey Nasser