three small proposals: the bikeshed cometh!

Brendan Eich brendan at
Thu Apr 29 17:52:24 PDT 2010

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

> On Thu, Apr 29, 2010 at 3:32 PM, Brendan Eich <brendan at>  
> wrote: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()
> Formally, that makes sense. But given that all the other
>     <keyword> ... "{" ... "}"
> productions, if they occur at the beginning of a statement, end with  
> the "}", I think this reading of the let expression may be  
> confusing. What if we adopt the same (admittedly unpleasant) rule we  
> already have for the "function" keyword: It can't begin an  
> expression statement. If it occurs at the beginning of a statement,  
> it is a statement. If you want a let expression in that position,  
> surround it with parens.

Yeah, we can do this -- it will not break us since we do it for  
function and { already. In particular, you can't start an object  
initialiser at the front of a statement -- this bites destructuring  
assignment with an object pattern too, but in practice it's ok:  
majority case uses a binding keyword to destructure to fresh names;  
minority case, you parenthesize.

Thanks for pointing this out.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list