Hopefully last word on Use Strict Directive syntax

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Tue Jun 9 13:29:30 PDT 2009



>-----Original Message-----
>From: Waldemar Horwat [mailto:waldemar at google.com]
...
>> On the other hand, I don't see any particular reason to disallow semi-
>colon insertion within the Directive Prologue. Given that we have it
>(even in strict mode) why would we disallow it here? It just adds
>specification complication and an additional special case for users to
>learn.
>
>You disallowed it previously, so I was simply expressing surprise at the
>change in your last email.  There was no discussion of this at the last
>meeting.

It was motivated by the addition of the possibility of multiple expression statements in a Directive Prologue.  
As soon as you have multiple "statements" semicolon insertion seems like a reasonable idiom for this language.

>
>Not sure what the technical ramifications are one way or another.
>They're probably limited to confusion if an implementation provides a
>use-directive that turns off semicolon insertion and other use-
>directives are used without a semicolon.  If you get into the habit of
>omitting semicolons, you can also run into trouble with things that look
>like they're strict but are not:
>
>function f(x) {
>  "use strict"
>  +x ? delete p : delete q;
>}
>

The above example seems like a pretty good reason to require explicit semicolons in the Directive Prologue although I guess the same hazard exists for all expression statements, not just directives.

Allen  


More information about the es5-discuss mailing list