three small proposals: the bikeshed cometh!

Brendan Eich brendan at mozilla.com
Thu Apr 29 14:59:45 PDT 2010


On Apr 29, 2010, at 2:50 PM, Mike Samuel wrote:

> Methinks "you protest too much, methinks" does not mean what you think
> it means :)

Ok, whatever the case, *I'm* protesting the rule written the way you  
wrote it :-).


> For tokens after which no semicolon can be inserted regardless of next
> token, I agree.

Great; I was interpreting your rule as stated a bit too literally.


> For others, I would prefer to limit the spread of semicolon- 
> insertion infection.
> And I would note that not restricting productions can make it harder
> to introduce new similar grammatical constructs later.

Agreed. We're really only talking about "yield" here, I claim.

I don't know what will happen with promises, but Mark's right that "!"  
could need restriction if it comes along as a binary operator. This is  
not on TC39's Harmony radar yet.


>> We're really talking about only postfix ++/--, "throw E", "return  
>> E", "break
>> L", and "continue L" if memory serves.
>
> And why is "throw" in that category if you're only interested in ASI  
> hazards.

Because it is in fact a restricted production (ES5 7.9.1 in the ASI  
summary, and the Throw Statement clause 12.13):

Syntax

ThrowStatement :
     throw [no LineTerminator here] Expression ;

Why is this? There's no rationale recorded in ES3 or ES5. I was not  
involved in ES3 all the way, only in the early few meetings. Waldemar  
may remember. It probably is this way because similarity to "return"  
means if "throw"'s production weren't restricted the same way,  
mistakes changing from one to the other, or expecting the two to work  
alike, would be more likely. Or it might have been future-proofing (as  
you note above, not restricting makes it harder later).

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


More information about the es-discuss mailing list