Jason Orendorff wrote:
Note that a similar shift in meaning occurs in ES1-5 after you've parsed `x.y` and then you see `(` or `=` or `++`. When we reach any of those tokens, we have to go back and check that the left hand side is valid, and this is nothing to do with any new ES6 features. (Admittedly, unlike the new features, this is something you can implement using finite lookahead. SpiderMonkey must have done it that way, once, before my time. Seems like it'd be messy.)
Very messy, and primordial JS (the "Mocha" interpreter) violated ECMA-262 Edition 1 on order of evaluation, e.g., o[x] = ++x where the RHS ++x must be evaluated *after* the Reference o[x] is evaluated. Fixing this prior to compiling to a parse tree required code buffering and reordering, just as the for loops (both of 'em) can.
Again, this goes back to the dawn of JS. We're not making it any worse. I don't see finite lookahead helping in general for any of these cases, BTW.
/be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

