(def ^:dynamic foo 42)
(go
(let [old foo]
(set! foo 45)
(println old foo)
(set! foo old)))
leaves the binding with the value 45 (same code as with binding+with-redefs). The problem is that the let binding is somehow inlining the reference to foo. For instance the println statement compiles to:
...
var inst_43089 = cljs.core.println.call(null,full.async.foo,full.async.foo);
...
I am currently having a look at ioc_macros.clj, but I couldn't find the problematic part yet. Any hints are helpful.
[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.8.34"]
[org.clojure/core.async "0.2.374"]
the 001 patch causes local bindings that are initialized from a global to actually create a local and initialize it from the global, instead of reading from the global.
patch 0002 is patch 0001, but using the same code path in let binding inits and loops binding inits
0003 adds a test for the expected local binding behavior when aliasing a global
Patch applied
Released in core.async 1.1.582