On Nov 11, 2011, at 8:19 AM, Mark S. Miller wrote: > On Fri, Nov 11, 2011 at 7:40 AM, gaz Heyes <gazhe...@gmail.com> wrote: > On 11 November 2011 15:33, Mark S. Miller <erig...@google.com> wrote: > let a = ({ > > print('doing stuff'); > 100; > }); > > How do you know the difference between a blank block statement and a object > literal? Surely it becomes an expression once an assignment occurs anyway. > > Doh! Sorry, I completely mis-thought that. Nevermind.
Your idea of mandatory parens is still valid (if, IMO, a bit unsatisfyingly verbose) for most statement forms. It's only the block-statement-expression that doesn't work. Hence my do-expressions: http://wiki.ecmascript.org/doku.php?id=strawman:do_expressions or Brendan's subtly-disambiguated-block-statement-expressions: http://wiki.ecmascript.org/doku.php?id=strawman:block_vs_object_literal If Brendan's idea can be made to work, and it's not too confusing, I'm pretty sure I'd prefer it over do-expressions. You could simply write: let a = { print('doing stuff'); 100 }; How gorgeous is that? But I suspect as we work on evolving the syntax of object literals, it'll get harder to keep them disambiguated. For example, is this: let a = { foo(x) { alert(x) } } ...equivalent to this? let a = { foo: function(x) { alert(x); } }; ...or this? let a = { foo(x); { alert(x); } }; So I just don't know if it's feasible. Dave
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss