"use strict"; prepended blindly to scripts in the wild

Mike Samuel mikesamuel at gmail.com
Wed Sep 8 17:11:08 PDT 2010


2010/9/8 Dean Landolt <dean at deanlandolt.com>:
>
>
> On Wed, Sep 8, 2010 at 6:25 PM, felix <felix8a at gmail.com> wrote:
>>
>> in the Names strawman, "private foo" at the top level has the same problem
>> as "use strict" at the top level.  maybe there should be a general way of
>> delimiting a top-level lexical scope, so that pasting js together is still
>> relatively easy?
>
> {
> "use strict";
> /* strict code */
> }
>
> Not sure if this is legit -- I seem to recall something about "use strict";
> being scoped at the block level (or at least that you can scope a specific
> if block). If so, wouldn't this suffice?

It is legit, but the "use strict" there is a string literal not a
prologue directive since those can only appear at the start of a
program or a function body.

> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


More information about the es-discuss mailing list