Module naming and declarations

Brendan Eich brendan at mozilla.com
Tue May 7 17:17:21 PDT 2013


Anne van Kesteren wrote:
> On Tue, May 7, 2013 at 4:39 PM, Jason Orendorff
> <jason.orendorff at gmail.com>  wrote:
>> Set aside absolute-url imports. Suppose we just dropped them. Would you
>> still think that module names are URLs? If so, do you think about other
>> languages in the same way?
>
> I think it's weird to try to equate JavaScript with those languages.
> They operate on multiple platforms that do not share a universal
> addressing system and therefore a layer of abstraction had to be
> invented to make it easier to work those languages across multiple
> platforms.

Again, that's not the issue.

The question is how should libraries and apps coordinate. For example, 
how does Ember express a dependency on jQuery without tying itself and 
its consumers to a particular version at a given URL, and without 
requiring custom loaders for everyone?

The idea of coordination names is not outré. Condemning such names for 
not being URLs is bad religion. Objecting to mixing URLs and lexically 
indistinguishable non-URLs in the same syntactic context -- there I 
think you are on more solid ground!


>   JavaScript within a browser context operates on a single
> platform that has a universal addressing system. And within that
> platform there are multiple non-programming languages, such as HTML
> and CSS, none of which support remapping URLs at the moment in a
> manner as it is proposed here, although
> https://github.com/slightlyoff/NavigationController/ will give that to
> us soon(ish).

(Speaking of misnomers... :-P)

> I guess that's another point I had not really thought of, the web
> platform will get a way to execute some script at "fetch", which is
> basically a low-level version of the module loader.

Forcing coordination names to be URLs and then magically remapping them 
with another subsystem smells. Why shouldn't the system work, batteries 
included, in any JS embedding (Node, e.g., where there's no 
NavigationController)?

In our private mail exchange, the idea of syntactic disjunction:

import "name";

vs.

import url "http://foo.com/bar/baz.js";

with the contextual "url" keyword after "import", came up. I'm not 
endorsing it, just publicizing it. If we are almost in agreement, but 
for the import syntax using a quoted string that's sometimes a URL and 
sometimes not, then it ought to be considered.

/be


More information about the es-discuss mailing list