David Herman wrote:
>> Also, I wonder why lambda in it's block-less form is restricted to
>> expressions.
>
> I'm with you... but I'd want to check with the experts on the ES grammar to
> see whether this introduces any nasty ambiguities.
Please specify what you are proposing. The one proposal I've seen is:
Expression ::= ... | lambda Formals Statement
This is not particularly useful because then even assign a lambda to a variable
would be a syntax error, and you'd introduce a bizarre asymmetry into the
ExpressionNoIn case.
The questions you'd have to answer are:
- Where in the expression grammar would you introduce a lambda?
- Is lambda a reserved word?
- How does it interact with semicolon insertion? As written, if the Statement
were an expression statement then the semicolon would be mandatory.
- Do you really want to have extra semicolons in the middle of statements? Now
you're forced to accept things like the following:
for (; lambda() x++;, lambda() y++;,; lambda() z++;) ...
Overall, this syntax does not look promising. It's likely to get you into
complexity trouble.
Waldemar
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss