On Apr 19, 2011, at 9:36 AM, John Tamplin wrote: > On Tue, Apr 19, 2011 at 11:52 AM, Brendan Eich <[email protected]> wrote: > So ASI does *not* change program behavior from non-error behavior A to > non-error behavior B. It instead suppresses early SyntaxError with successful > evaluation, in a deterministic way. > > Is that true even in the "return \n expression" case? It certainly seems to > be not an error before or after ASI, yet the result is quite different.
I meant to exclude the restricted productions in writing "plus of course built-into-the-grammar restricted productions". If you include the restricted productions, which are part of the grammar, then there is only one way to parse "return \n expression", including a semicolon insertion. This doesn't make the restricted production case any less of a bitter pill to swallow when writing long returns. But there's only one way to parse such a sentence. ASI as in "inserting a semicolon to recover from an error" did *not* change "return expression" to "return; expression". Rather, the restricted production kept the parser from even considering the expression as the return value, and the automatic insertion fixed up the lack of a properly terminated return statement. /be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

