Minimal Module System Proposal

Russell Leggett russell.leggett at gmail.com
Thu Feb 7 20:11:43 PST 2013


On Thu, Feb 7, 2013 at 9:25 PM, Kevin Smith <khs4473 at gmail.com> wrote:

>
> Thanks, but let's not jump to any conclusions. I'm the champion of modules
>> and wasn't even able to be a part of the discussion for family reasons. We
>> can't make any judgment about the status of modules, or plans for reacting
>> to the status of modules, before I've had a chance to be a part of the
>> conversation.
>>
>>
>  +1 and congrats (I'm slinging a babe right now ; )
>
> I'm confident that modules will make it - in my mind ES6 will fail if not.
>  They are certainly more important than proxies and private names, and the
> sooner we coalesce around the syntax, the better everyone will feel.  IMO,
> your previous proposal was almost right on.  e.g.
>
> http://wiki.ecmascript.org/doku.php?id=harmony:modules&rev=1332511079
> https://gist.github.com/khs4473/4382710
>
> I think we need to have a knock-down-drag-out discussion about URL and
> loader semantics.  ; )
>

In the home brewed module system that I've been using for the past 4 years
or so, I started by basically stealing from Java - in a comment at the top
of a file I do sort of java style imports:


/*
 * #import com.foo.bar.SomeClass
 */

It had the usual sort of Java style semantics (we're a Java shop, so this
works for us). Along the way, I added support for importing java classes -
this would basically do some java -> javascript model building magic and
exposing services, etc. The notation for it looks mostly the same except
for:

/*
 * #import remote com.foo.bar.JavaClass
 */

The sort of import modifier "remote" in there is the difference. Its just a
bit of meta-data, but it helped with resolution of the dependency. Along
the way, I've also added "lazy" as a modifier, which helps know how to
break apart the application when I do concatenation during the build.

I'm not suggesting this syntax or semantics, but it occurred to me that
perhaps if we could work some metadata into an import statement it could be
a way of giving additional information to the loader. Perhaps it could be
used for url resolution. For example, the "cdn" flag would let the loader
know to resolve the url to a cdn, etc.

- Russ


> { Kevin }
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130207/570e3d77/attachment.html>


More information about the es-discuss mailing list