Module naming and declarations

Kevin Smith zenparsing at gmail.com
Fri Apr 26 21:22:48 PDT 2013


> 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.
>
>
Let see how we might build package systems on top of this.  Let's say that
I want to create a package management system named "browserpm".  Now, since
I don't want any of my names conflicting with some other PM's names, the
logical name for modules within my registry will need to include the
registry name itself:

    import something from "browserpm/taskjs";

This looks *almost* like a real URL.  Why not just use a URL instead?

    import something from "//browserpm.org/taskjs";

I could even serve the source code directly from the "browserpm.org" site.
 If we want to load scripts from our local server, we would just override
the module URL resolution algorithm:

    "//browserpm.org/taskjs" => "/modules/browserpm.org/taskjs";

It seems to me that, *long term*, URLs provide all of the advantages of
"logical names", without the downside of sacrificing one of the core
principles of the web:  namely, that resources are represented by URLs.

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130427/fce778b6/attachment.html>


More information about the es-discuss mailing list