nrepl/piggieback

Can't change/establish root binding of: *cljs-warnings*

bmaddy opened this issue ยท 3 comments

When using binaryage/oops {:mvn/version "0.6.2"} in an emacs repl I got the following error:

user> (oset! (js-obj) :mood "a happy camper")
IllegalStateException Can't change/establish root binding of: *cljs-warnings* with set  clojure.lang.Var.set (Var.java:223)

After some help from @darwin, I believe it's because oops is trying to set *cljs-warnings* here https://github.com/binaryage/cljs-oops/blob/master/src/lib/oops/compiler.clj#L43 and that's not included in the bindings that can be set here https://github.com/nrepl/piggieback/blob/master/src/cider/piggieback.clj#L301.
Interestingly, when the same function call is used in a file instead of the repl, it does not throw an error. I would have submitted a patch, but I couldn't figure out how to test the change to ensure it works.

More details here: https://gist.github.com/bmaddy/2a94b1a36b651936dbf1c35b16e028b2

I'll defer on @bhauman regarding this, as our resident ClojureScript expert.

See if this is fixed for you in 0.3.10.

Yep, it works like a charm (that second error is expected). Thank you! ๐Ÿ˜„

cljs.user> (oset! (js-obj) "!k1.!k2.!k3" "val")
#js {:k1 #js {:k2 #js {:k3 "val"}}}
cljs.user> (oset! (js-obj) :mood "a happy camper")
Oops, Missing expected object key 'mood' #object[devtools.toolbox.t_devtools$toolbox47491]