On Mon, Jun 9, 2014 at 9:40 AM, Caridy Patino <car...@gmail.com> wrote:
> another issue with `this` being `global` (as it is today by the specs) is > the way top level modules will be defined in a page, assuming we will have > `type="module"` for scripts (which is probably were we want to be), what > will be the difference between: > > <script type="module"> > this.foo = 1; > var bar = 2; > import main from "main"; > </script> > > and > > <script> > this.foo = 1; > var bar = 2; > System.import("main"); > </script> > In the 'module', 'bar' is local and 'main' is imported before the module is evaluated. In 'script' bar is global and the 'main' is imported at the end of the script. The fate of 'this.foo' hangs in the balance until TC39 speaks. > > it seems to me that the current definition, where `this` is `global`, will > be an issue when it comes to avoid global variable definition. Ideally, for > modules, `this.foo` and `bar` will be contained, to have a clear > differentiation with the regular `script` tags. > My point: if 'this' is not global in modules, then ES6 must have an alternative way to name the global object. > > /caridy > > > On Mon, Jun 9, 2014 at 12:27 PM, Kevin Smith <zenpars...@gmail.com> wrote: > >> >> The genuine global is typically the source of tremendous amounts of >>> authority. Much of the mechanism of SES is built to deny access to the >>> genuine global and to non-whitelisted global variables. Can the module >>> loader API be used to load a module with a different top level binding for >>> "this"? >>> >> >> IIUC, that use case is provided for with custom module loaders (where you >> can specify the realm and such). >> >> >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss