return when desugaring to closures

liorean liorean at gmail.com
Wed Oct 15 17:07:24 PDT 2008


>>> Please specify what you are proposing.  The one proposal I've seen is:
>>>
>>> Expression ::= ... | lambda Formals Statement

> Dave Herman wrote:
>> Yes, that's what I meant, or at least what I thought Yuh-Ruey meant.
>>
>>> This is not particularly useful because then even assign a lambda to a
>>> variable would be a syntax error,
>>
>> Why is that?

2008/10/15 Waldemar Horwat <waldemar at google.com>:
> Because there exists no sequence of grammar production expansions that would expand to "a = lambda() x;".

Only if you disallow newlines in the lambda syntax. This is certainly
allowed in ES3:

    a=lambda()
    x;

Same goes for

    a=lambda
    {...}

or

    a=lambda(...)
    {...}
    (...)

or any number of similar plays with the semicolon insertion rules.
-- 
David "liorean" Andersson


More information about the Es-discuss mailing list