Module naming and declarations

Andreas Rossberg rossberg at google.com
Mon Apr 29 06:52:45 PDT 2013


On 27 April 2013 01:17, David Herman <dherman at mozilla.com> wrote:
> 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.

That actually is a moot point, however, since we had long decided that
module declarations would live in the lexical top-level scope, so not
inherit any of the global object craziness. And given that, and the
assumption of using a package manager that could do the set-up, I
think Kevin's is a valid question. If all you allow are simple logical
path names, then I see no substantial advantage of the current design
over sharing modules via global identifiers.

That said, I don't see it as sufficient either. But I conjecture that
if you have lexical modules + a loader + the ability to use the full
URI name space for imports, then everything else can be programmed on
top in whatever way anybody prefers. No need to bake anything more
specific into the language.

/Andreas


More information about the es-discuss mailing list