Subj : Re: ++0 is not a syntax error? To : Brendan Eich From : Igor Bukanov Date : Wed Aug 18 2004 07:03 pm Brendan Eich wrote: > Igor Bukanov wrote: > >> Hi! >> >> As far as I can see ECMAScript requires that ++0 should produce >> RuntimeError, not SyntaxError. So, for example, the following should >> be OK: >> >> var f = Function('++0') >> >> and only during call to f RuntimeError should be generated. Microsoft >> JScript and KDE JavaScript implementation follows this while >> SpiderMonkey behaves much saner IMO and report SyntaxError during >> parsing. But does ECMA-267 allow this early error reporting? >> >> Regards, Igor > > > > Yes, explicitly so, per Section 16 of ECMA-262 Edition 3: Thanks, I missed that. I will make Rhino to match SM in this respect. While changing Rhino parser to allow to use native functions as left-hand-side expressions in Rhino, I assumed that bad left hand side should always be a runtime error and added a few lines of code to handle that. But those comments in the standard allows to remove those lines and make Rhino as JS syntax checker to work better. Regards, Igor .