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

felix felix8a at gmail.com
Wed Sep 8 18:34:23 PDT 2010

On 9/8/10 17:25, Brendan Eich wrote:
> On Sep 8, 2010, at 3:25 PM, felix 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?
> Today, module pattern:
> (function () {
>    // "use strict" or private x; here without fear...
> })();

that's not quite the same thing since the innards can't introduce new 
top-level bindings.  you can't just wrap an arbitrary js file in the 
module wrapper and still have it work.  you have to rewrite it.

I guess the transformation could be automated, though it's a bit more 
complex than just concatenation.

More information about the es-discuss mailing list