Module naming and declarations
dherman at mozilla.com
Fri Apr 26 16:17:26 PDT 2013
On Apr 26, 2013, at 7:27 AM, Kevin Smith <zenparsing at gmail.com> wrote:
> What you propose, with "logical names", is a global namespace of short human-readable names with *no* conflict resolution authority. How do you see that working? From a namespace perspective, how is that any different than hanging identifiers off of the global object, as we do today? I'm not understanding how this strategy will facilitate namespace coordination. I can only see it leading to namespace confusion.
Well first, it's much cleaner than the global object, because it does not involve the mess of prototype chains and sharing space with a DOM object's properties and methods.
There is, of course, a need for people to agree on common naming for shared modules. If they want to use conventions to avoid name collisions, there's in fact nothing preventing them from doing something like Java's reverse-DNS:
import spawn from "org/calculist/taskjs";
import Promise from "io/tilde/RSVP";
And note that Java also does not mandate reverse-DNS, it's just a convention. But in fact, that convention is really annoying and people hate it. Node uses much simpler global names that are reserved via NPM. This does lead to collisions and some people don't like that; an alternative system could use usernames. These are all viable alternatives, and what will really be needed will be package management systems like NPM for the web. What we are creating here is the basic semantics that provides a way for people to refer to shared modules. People can and should build package management systems, including tools, servers, and web sites, on top of this.
More information about the es-discuss