`this` inside modules

Axel Rauschmayer axel at rauschma.de
Mon Jun 9 06:42:58 PDT 2014


> Axel, using `module` was the first proposal analyzed (3.1 from the gist). I do like it a lot, but other in the meeting opposed to any sort of "automagic" by wrapping the module execution into a function execution with the `module` argument (a la nodejs),

Overloading `this` feels even more magic to me and is much less self-descriptive. Apart from the overloading problems (which are significant!), I don’t see that much of a difference between passing in a value for `this` and setting up a – descriptively named – module-scoped variable.

> and the fact that `this` is not really the module, it is an object that contains, among other things, a reference to another object with the live binding, a relative import, a relative get, etc.


Give it a different name, then. Call it `moduleDescriptor`, `moduleData`, etc.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140609/c1bb6e4d/attachment-0001.html>


More information about the es-discuss mailing list