three small proposals: the bikeshed cometh!

Brendan Eich brendan at mozilla.com
Thu Apr 29 15:32:29 PDT 2010


On Apr 29, 2010, at 3:16 PM, Mark S. Miller wrote:

> On Thu, Apr 29, 2010 at 2:39 PM, Brendan Eich <brendan at mozilla.com>  
> wrote:
> Really, methinks you guys protest too much. In particular Mike's  
> "all new productions that introduce a new keyword should be  
> restricted" is simply wrong for "let".
>
> Btw, regarding "let", ASI, and Dave's recent "let" expression  
> proposal <http://wiki.ecmascript.org/doku.php?id=strawman:let_expressions 
> >, how should
>
>     let () { => foo }
>     (3, 4)
>
> parse? Is it a function call?

As far as I can tell, this is covered by ECMA-262 7.9.2:

The source

   a = b + c
   (d + e).print()

is not transformed by automatic semicolon insertion, because the  
parenthesised expression that begins the second
line can be interpreted as an argument list for a function call:

   a = b + c(d + e).print()

In the circumstance that an assignment statement must begin with a  
left parenthesis, it is a good idea for the
programmer to provide an explicit semicolon at the end of the  
preceding statement rather than to rely on automatic
semicolon insertion.


As David-Sarah Hopwood pointed out a while ago, there's no error to  
correct.

I'm assuming here that let () { => foo } will be a PrimaryExpression.  
The always-braced body avoids reduce-reduce conflicts Waldemar pointed  
out in connection with ES4's unbracketed let expression body.

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20100429/50b5f255/attachment.html>


More information about the es-discuss mailing list