too-early feedback implementing ECMA6 array comprehension syntax

Brendan Eich brendan at mozilla.org
Fri Jun 8 15:58:01 PDT 2012


Allen Wirfs-Brock wrote:
> It may well be that the initial Expression of the ArrayComprehension 
> productions should be an AssignmentExpression  in order to avoid commas.

This is just a draft-spec grammar bug. What I implemented in 
SpiderMonkey many years ago is what is grammatically necessary: 
AssignmentExpression. Otherwise you have not only a readability problem 
as Jay wrote, but a real problem in top-down parsers deciding whether 
you are in an array initialiser or array comprehension. Bottom up 
parsers can cope but practical implementations are all top-down.

Jay, thanks for pointing this out.

/be


More information about the es-discuss mailing list