Revenge of the double-curly [Was: return when desugaring to closures]

Brendan Eich brendan at mozilla.com
Sat Oct 11 11:57:30 PDT 2008


On Oct 11, 2008, at 7:25 AM, David-Sarah Hopwood wrote:

> It is correct to say, though, that:
>
>  function foo() {
>    ...
>    { var bar = baz; }
>    ...
>  }
>
> is equivalent to
>
>  function foo() {
>    let bar = undefined;
>    ...
>    { bar = baz; }
>    ...
>  }
>
> That is, 'var' need not be primitive. Only 'let' needs to be  
> primitive.

Indeed.


> Similarly, if we are careful in specifying 'lambda' then 'function'  
> need
> not be primitive, since it will be expressible as a rewrite to  
> 'lambda'.

Yes, this is called out already in

http://wiki.ecmascript.org/doku.php?id=strawman:lambdas

/be




More information about the Es-discuss mailing list