Brendan Eich wrote:
var y = (a) => a ? f : x++ (1);

evaluated (or is it syntactically valid at all)?

The problem with expression closures is precedence inversion: you have LowPrec ~~> HighPrec ~~> stuff ending with LowPrec. The particular nonterminals are AssignmentExpression and PrimaryExpression.

No such problem afflicts arrows, because they are low-precedence, in fact AssignmentExpression alternative right-hand sides. So your example here is a syntax error, because you are placing two assignment expressions

I mean an assignment expression followed by a primary expression, of course. The `(a) => a ? f : x++` arrow is an assignment expression, the `(1)` is a separate expression. The `(1)` cannot be the actual parameter list for the arrow unless you parenthesize the arrow to make it be a MemberExpression (the highest precedence non-terminal that can be the callee in a CallExpression).

Precedence, whee!

/be

next to one another with no operator or semicolon in between.


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to