Thanks! On Fri, Jul 22, 2016 at 11:14 AM Allen Wirfs-Brock <[email protected]> wrote:
> > On Jul 22, 2016, at 10:04 AM, Bradford Smith <[email protected]> > wrote: > > A brief search didn't turn up any test cases that would enlighten me > regarding why the rules for UpdateExpression are: > > UpdateExpression : > { ++ | -- } UnaryExpression > LeftHandSideExpression { ++ | -- } > > You can't increment or decrement anything that isn't a > LeftHandSideExpression, so why does the syntax rule allow UnaryExpression > as an argument for update in the prefix case? > > > It’s basically preserve legal syntax that extends all the way back to the > ES1 specification: > http://ecma-international.org/publications/files/ECMA-ST-ARCH/ECMA-262,%201st%20edition,%20June%201997.pdf > > > that syntax means that something like: > > if (false) ++ -42; > > Is syntactically valid. A program containing such a line will load and > execute without error. > > Changing the grammar (or static semantics rules) to make that illegal > would be a ”breaking change” that might cause some valid existing scripts > to suddenly fail to load. > > Allen >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

