jashkenas/coffee-script — Issue #1804: Possibly bring back closed over variables in loops.
Author: jashkenas
Created: 2011-10-25 21:06:03+00:00
State: open
Labels: enhancement

Chatting with @swannodette the other day ... he mentioned that ClojureScript managed to smartly close over loop-local variables, to provide `let` semantics. We used to have this, but abandoned it due to inconsistencies back when we introduced `do`.

for item in list
functions.push ->
call item

... used to close over the per-iteration value of `item`. If ClojureScript indeed manages to do this without leaky semantics, perhaps we can follow suit.