> - Does it ever make sense to access globals via "this"? If so, I assume there > will be a use case in the upcoming modules rationale document.
Reflecting the globals via |this| preserves some web compatibility with programs that dynamically test the global object. It allows you some lightweight reflection of the global scope, while removing some of the more problematic reflection of legacy JS (such as deleting globals). For example, you can dynamically detect whether a variable is bound. > - Should there be a keyword for "the current module" (a module-this, if you > will)? Accessing module-global data via "this" feels strange (I that is > indeed the intention of what I have read). It would also not work inside > methods. I don't know why it feels strange to you; it feels pretty natural to me. Banning |this| in certain contexts has never been done in JS and I don't want to start doing it. If we don't ban it, it has to have some binding. Binding it to null or undefined would also be draconian. When modules are reflected as first-class values, they are represented as objects. The body of a module acts as the object's constructor. Binding the module object as |this| fits naturally with the design. > But it seems like the only globals inside a module are module-relative. Then > everything would work out fine. I don't understand this comment. Dave _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

