return when desugaring to closures

Brendan Eich brendan at mozilla.com
Thu Oct 16 12:04:38 PDT 2008


On Oct 16, 2008, at 11:38 AM, Waldemar Horwat wrote:

> Brendan Eich wrote:
>> That's not a valid grammar.

It is unambiguous. How do you define "valid"?

>>  You can't have an AssignmentExpression terminating a  
>> PrimaryExpression.  It leads to trouble such as:
>
> let a = b + c
>
> being interpreted as both:
>
> (let a = b) + c

No, it clearly parses as:

> let a = (b + c)

and we've shipped this for several releases, and it sees use -- it has  
not been problematic. Parenthesize if you mean (let a = b) + 1.

Same goes for expression closures. Bottom up parsers will shift, top  
down will consume greedily. So what's the real problem?

/be


More information about the Es-discuss mailing list