`this` inside modules

Caridy Patino caridy at gmail.com
Mon Jun 9 09:40:56 PDT 2014

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";


this.foo = 1;
var bar = 2;

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.


On Mon, Jun 9, 2014 at 12:27 PM, Kevin Smith <zenparsing at 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 at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140609/7e8fc02d/attachment.html>

More information about the es-discuss mailing list