Welcome! Please see the About page for a little more info on how this works.

+4 votes
in Clojure by
closed by

I see that the new add-lib in Clojure 1.12 doesn't call clojure.core/load-data-readers (like clojure.core does on loading) so if you bring libraries that have data-readers you can't use them.

Calling clojure.core/load-data-readers from the repl doesn't solve the issue since it changes *data-readers* root value which is already being shadowed by clojure.main/repl.

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-rc1"} com.github.flow-storm/flow-storm-dbg {:mvn/version "3.17.2"}}}'
Clojure 1.12.0-rc1
user=> *data-readers*
{trace #'flow-storm.api/read-trace-tag, ctrace #'flow-storm.api/read-ctrace-tag, rtrace #'flow-storm.api/read-rtrace-tag, tap #'flow-storm.api/read-tap-tag, tap-stack-trace #'flow-storm.api/read-tap-stack-trace-tag, flow-storm.types/value-ref #'flow-storm.types/make-value-ref, amalloy/ring-buffer #'amalloy.ring-buffer/read-method}

now with add-lib :

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-rc1"}}}'                                                             
Clojure 1.12.0-rc1
user=> (add-lib 'com.github.flow-storm/flow-storm-dbg {:mvn/version "3.17.2"})
[...]
user=> *data-readers*
{}
user=> (#'clojure.core/load-data-readers)
{trace #'flow-storm.api/read-trace-tag, ctrace #'flow-storm.api/read-ctrace-tag, rtrace #'flow-storm.api/read-rtrace-tag, tap #'flow-storm.api/read-tap-tag, tap-stack-trace #'flow-storm.api/read-tap-stack-trace-tag, flow-storm.types/value-ref #'flow-storm.types/make-value-ref, amalloy/ring-buffer #'amalloy.ring-buffer/read-method}
user=> *data-readers*
{}

The only way I see to bring in data-readers with add-lib is by starting a sub-repl :

clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.12.0-rc1"}}}'
Clojure 1.12.0-rc1
user=> (add-lib 'com.github.flow-storm/flow-storm-dbg {:mvn/version "3.17.2"})
[...]
user=> (binding [*data-readers* (#'clojure.core/load-data-readers)] (clojure.main/repl))
user=> *data-readers*
{trace #'flow-storm.api/read-trace-tag, ctrace #'flow-storm.api/read-ctrace-tag, rtrace #'flow-storm.api/read-rtrace-tag, tap #'flow-storm.api/read-tap-tag, tap-stack-trace #'flow-storm.api/read-tap-stack-trace-tag, flow-storm.types/value-ref #'flow-storm.types/make-value-ref, amalloy/ring-buffer #'amalloy.ring-buffer/read-method}

which won't work with nrepl tooling.

closed with the note: Releasing in 1.12.0-rc2

1 Answer

0 votes
by
...