Missing root binding for explain-out

I am finding a weird situation here: in a compiled uberjar I get this exception:

Caused by: java.lang.IllegalStateException: Can't change/establish root binding of: *explain-out* with set
	at clojure.lang.Var.set(Var.java:223)
	at cli_matic.optionals$orchestra_instrument.invokeStatic(optionals.clj:70)
	at cli_matic.optionals$orchestra_instrument.invoke(optionals.clj:56)
	at cli_matic.presets__init.load(Unknown Source)
	at cli_matic.presets__init.<clinit>(Unknown Source)
	... 126 more

(as per https://github.com/l3nz/cli-matic/blob/v0.2.7/src/cli_matic/optionals.clj#L70 )

and lein deps :tree says (among a ton of other libraries):

[org.clojure/clojure "1.9.0"]
   [org.clojure/core.specs.alpha "0.1.24"]
   [org.clojure/spec.alpha "0.1.143"]
 [cli-matic "0.2.7"]
   [expound "0.7.1"]
   [org.clojure/tools.cli "0.4.1"]

And in Clojure 1.9 we are supposed to have *explain-out*: https://github.com/clojure/clojure/blob/clojure-1.9.0/src/clj/clojure/main.clj#L85

So what is going on here? also, why line 70 and not 74? I run a lein clean.

PS. writing a library is an excellent way out of our comfort zone. :smile:

Hum, I might be getting things mixed up, but I don’t think you can use set! on a root binding. You have to use alter-var-root instead.

You can only set! inside a binding. So you can set the thread local only.

One thing that is confusing is that the REPL often will bind some of the global dynamic vars, so you can set! them.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.