(CLJS) the binding macro/let binding is wrongly inlined

Description

(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.

Environment

[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.8.34"]
[org.clojure/core.async "0.2.374"]

Activity

Show:
Kevin Downey
April 7, 2016, 2:50 AM

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.

Kevin Downey
April 7, 2016, 4:16 AM

patch 0002 is patch 0001, but using the same code path in let binding inits and loops binding inits

Kevin Downey
April 7, 2016, 6:49 PM

0003 adds a test for the expected local binding behavior when aliasing a global

Alex Miller
March 31, 2020, 6:32 PM

Patch applied

Alex Miller
March 31, 2020, 7:54 PM

Released in core.async 1.1.582

Fixed

Assignee

Kevin Downey

Reporter

import

Labels

Approval

Triaged

Patch

Code

Priority

Major
Configure