Brendan Eich brendan at mozilla.org
Thu Aug 21 23:22:01 PDT 2008

On Aug 21, 2008, at 10:10 PM, Breton Slivka wrote:

> In the case of let statements, as I understand it, the current
> proposal, and how let works in firefox is that
>  let (x = 2, y = x) {
>  print(y);
>  }
> "desugars" to
> {
> let x = 2, y = x;
> print(y);
> }

No, because in the latter, as for var in a program or function body,  
let x is hoisted to the top of the block, so y's initializer x is not  
the value of the outer x, but the undefined initial value of the  
hoisted inner x.

So let statements really are different from let declarations in blocks.

New let forms may look spooky or useful, depending on your language  
background. Schemers tend not to be spooked; folks who started with  
JS, Java, C++ or C may bolt ;-).


More information about the Es-discuss mailing list