Hopefully last word on Use Strict Directive syntax

Douglas Crockford douglas at crockford.com
Tue Jun 9 16:36:11 PDT 2009


>>>> function f(x) {
>>>>  "use strict"
>>>>  +x ? delete p : delete q;
>>>> }
>> This hazard, OTOH, can't be fixed, because the "use strict" is not a
>> directive in this case, and you would have to know that it is a
>> directive
>> before you could require a semicolon after it.
>>
> 
> This seems like a strong argument for not trying to forbid semicolon insertion in the Directive Prologue. 
> 
> My current thinking is that we shouldn't try to outlaw it in the Directive Prologue.

I don't understand the argument. The thing that recognizes the pragma also looks 
to see that it is followed by a semicolon, and fires a syntax error if it is 
missing. I think Waldemar's argument was the strong one.


More information about the es5-discuss mailing list