Proposal: Modify automatic semicolon insertion in strict mode

Brendan Eich brendan at
Tue Dec 9 10:26:45 PST 2008

On Dec 9, 2008, at 1:00 AM, David-Sarah Hopwood wrote:

> Brendan Eich wrote:
>> On Dec 8, 2008, at 9:48 PM, David-Sarah Hopwood wrote:
>>> Why? That would only happen if you added "use strict;" to a program
>>> fragment without testing that the resulting program still parses
>>> correctly,
>> Parses and executes over all paths correctly, you must mean.
> No, I don't. The context was an argument against removing semicolon
> insertion from strict mode. If you add "use strict;" (to code that is
> statically known, not to code that is passed to 'eval') and the  
> resulting
> program still parses, then you know that the lack of semicolon  
> insertion
> in strict mode made no difference. It isn't necessary to run the  
> code in
> order to test that.


s = 'c';
b = 42;
c = 33;
g = 1;
Number.prototype.exec = function(s){var c=this; return eval(s);};
a = b

Verify by adding a semicolon at the end of the a = b statement  
expression and noting the different result.

> Of course you should do other testing as well, to account for other
> differences between non-strict and strict mode, but that's not  
> relevant
> to semicolon insertion.

How's the weather there on planet Utopia?

I see that Neil Mix made the obvious point about the game theory here.  
Don't put strict mode on the losing side or it will not be used as  
much as you would like.


More information about the Es-discuss mailing list