Semantics and abstract syntax of lambdas

Brendan Eich brendan at mozilla.com
Thu Dec 18 19:45:14 PST 2008


On Dec 18, 2008, at 8:43 AM, Brendan Eich wrote:

> On Dec 18, 2008, at 6:45 AM, Lex Spoon wrote:
>
>> x => x+1
>> x => {{ var y = x+1; y*2 }}
>
> There's no need to double braces in the => syntax if we require an  
> object initialiser to be parenthesized:
>
> x => ({p: 1, q: true})

GNU C statement expressions are bracketed by ({ and }) too. Not  
recommending that as a lambda syntax (evaluation model would want it  
to desugar to a lambda that's immediately applied with no argument).

Probably this GNU C extension is an recommendation against any  
dissimilar addition to JS of ({Stmt; ...}), thinking a bit more ;-).

/be


More information about the Es-discuss mailing list