Igor Bukanov wrote: > Of cause, if desired, such shortcut should be > pure syntax extension over ES3, not {{ }} as that silently changes the > meaning of the existing code.
Do you really think {{ }} appears in existing code, correctly enclosing statement blocks, with the {{ and the }} placed tightly together both at the beginning and at the end? I find this somewhat unlikely, since it's a redundant repetition that means exactly the same as { }. Ingvar Igor Bukanov wrote: > 2008/7/25 Lars Hansen <[EMAIL PROTECTED]>: >> Is >> >> {{ return }} >> >> syntactic sugar for >> >> (function() {{ return }})() >> >> too? > > I have forgot about the return or break/continue. But this is not a > point since a syntax sugar for (function() { code })() can require > that code must not contain return or break/continue outside the code > effectively making it a let expression on steroids. The point is that > is it worth to provide a shortcut for (function() { code })() since > that is used on web. Of cause, if desired, such shortcut should be > pure syntax extension over ES3, not {{ }} as that silently changes the > meaning of the existing code. > > One way to get that extension comes from an observation that ES4 > allows to drop the braces around function body and the return keyword > if the body is the single return exp. If ES3.1 would support it, then > to simulate an effect of let expression like > > let (a = arg1, b = arg2) expression > > one could write > > (function(a, b) expression)(arg1, arg2) > > or > > (function(a, b) a = arg1, b = arg2, expression)() > > If, in addition to this shortcut, ES4 would allow to drop an empty > argument list from a function with a requirement that function { } > always means an expression and ES3.1 would also support that, then in > place of a block with let variables one can write: > > function { > > }(); > > Regards, Igor > _______________________________________________ > Es4-discuss mailing list > Es4-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es4-discuss > -- Ingvar von Schoultz ------- (My quirky use of capitals in code comes from my opinion that reserved and predefined words should all start with lowercase, and user-defined should all start with uppercase, because this will easily and elegantly prevent a host of name-collision problems when things like programming languages are upgraded with new labels.) _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss