`this` inside modules
caridy at gmail.com
Sun Jun 8 21:52:54 PDT 2014
Dominic, those are some of the my notes, which by no means cover all the
discussion around this topic. @ericf will be posting the full detailed
explanation of the stuff we covered.
This is definitely an area that we should continue discussing, especially
the API of the "module meta" object, and how to access it from within the
module body. I can tell that @wycats and @ericf are opposed to any magic
surrounding the module execution (a la nodejs). In the other hand,
`System.currentModule` is probably a bad idea because you don't know which
loader was used to load the module (remember that you can use a custom
loader for that).
As for the "execution context", the gist mutated multiple times (the
original question was about the specs, and the lack of clarity about the
evaluation of the module), and we ended up looking into the details of how
to access the module meta and loader. Again, this is by no means a doc to
On Mon, Jun 9, 2014 at 12:25 AM, Domenic Denicola <
domenic at domenicdenicola.com> wrote:
> seems to indicate `this` will become some sort of module meta object with a
> variety of abilities: `this.name`, `this.address`, `this.import`,
> `this.get`, and `this.module`.
> This seems like another unfortunate addition to the WTFJS canon, as it
> continues to add more confusing meanings for `this` to the mix.
> IMO it would be much better to leave `this` as `undefined`, just as it is
> in strict mode scripts, and thus be able to tell a consistent story that in
> ES6, `this` is about methods. The current proposal would instead create a
> world where `this` is about methods most of the time, but is a magic
> ambient variable in some cases (sloppy scripts, modules). This kind of
> confusion is evident even in the title of that section: it asks “what is
> the execution context for a module,” but it is actually talking about
> `this`, which has nothing to do with [execution contexts].
> If a magically in-scope binding is necessary to access module meta
> capabilities, giving it a name like `module` or `System.currentModule`
> would be much better.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss