On Nov 10, 2011, at 11:07 PM, Dmitry Soshnikov wrote: > Brendan and Dave mention explicit semicolon. Yes, it's seems so by the > grammar (though, have to check more precisely), but it can be acceptable > price.
No, it is a runtime incompatibility that shifts meaning, without errors. switch (x) { case 1: (function (){return 42}); break; default: (function (){return 99}); } (a[i].b()).c(d) The switch is now the callee expression in a call taking one actual parameter, a[i].b(). The same can happen with leading [, unary +/-, and / as regexp delimiter -- any lexeme that can both start a statement and continue an expression. > P.S: > > Regarding Dave's `do { .. }` -- we may omit `do` and just evaluate the block. > > let a = { > print('doing stuff'); > 100; > }; > > It's of course seems ambiguous with an object initialiser (at first glance), > but it's only at first glance. Obviously there is a code inside to evaluate. I worked on this, based on ideas from Breton Slivka and Doug Crockford. Please see http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax and https://mail.mozilla.org/pipermail/es-discuss/2011-June/015568.html This is not going to fly in a grammar that we validate using LR(1) parsing. Block-lambdas require {|| at least to defer evaluation until invocation, whereas any block-expression would be immediately evaluated. This could be a point of confusion. Altogether, this says Dave's 'do' proposal is better because EIBTI. /be > > Cheers, > Dmitry. > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss