January 19 meeting notes

Axel Rauschmayer axel at rauschma.de
Thu Jan 19 20:20:00 PST 2012


Given that this desugaring will only kick in if a closure leaves the loop (right?), this is a case of automatically doing the right thing (and only if it’s warranted).

> Yes kids, this means we are going with MarkM's lambda desugaring from:
> 
> https://mail.mozilla.org/pipermail/es-discuss/2008-October/007819.html
> 
> So any closures formed in the body of such a for(let...;...;...) loop will capture the binding created afresh for that iteration. This avoids the nasty need for CoffeeScript "do" or the expanded JS equivalent of an IIFE surrounding the closure to create per-iteration storage for a copy of the loop control variable.
> 
> Contrary to Jon Zeppieri's good argument at
> 
> https://mail.mozilla.org/pipermail/es-discuss/2008-October/007826.html
> 
> that
> 
> {
>    let x = 0;
>    for (; x<  n; x++) ...
> }
> 
> should have different behavior than
> 
> for (let x = 0; x<  n; x++) ...
> 
> those of us left from the TC39 meeting (missing a few reps, short of quorum) favored the greater-good argument ofprogrammer who follow'let is the new var' and who form closures in loops benefiting from the fresh let binding being captured, instead of one binding per loop where the likely value of the binding is the terminating loop control.
> 
> Yay (I'm pretty sure).

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120120/c5ba68af/attachment.html>


More information about the es-discuss mailing list