Module Comments

Kevin Smith khs4473 at gmail.com
Thu Dec 6 06:42:47 PST 2012


Summaries with comments:

1) "export" ExportSpecifierSet ("," ExportSpecifierSet)* ";"
>

Brendan pointed out that other binding forms allow lists (including the
import form), so why not this one?  I actually didn't realize that lists
are allowed with import:

    ImportDeclaration ::= "import" ImportClause ("," ImportClause)* ";"

Fair enough.

2) Do we need `export *;`?
>

Sam pointed out two use cases:

1) Conveniently exporting everything from "little convenience modules".

I'm not really convinced by this.  It's just so easy to export things by
adding the export keyword.

2) Re-exporting a collection of imports from other sources.

This is better, at least in the case where you want to import a
well-defined set of bindings and then re-export those same bindings later.
 Without `export *;`, you'd have to keep those binding lists in sync.
 Sounds reasonable to me.

3) I'm just OK with "as".  Note that it inverts the position of the string
> and the binding:
>

Claus and Matthew suggested using the "no-curlies" form instead:

    import ga from "ga";

Dave responded by pointing out that we don't want "from" to have overloaded
semantics.  I actually think this form has potential, because it further
aligns import with the other binding forms:

    var a = x;
    var { b } = y;

    // Symmetry!

    import a from "x";
    import { b } from "y";

5) Dynamic exports via `export = ?` could make interop with existing module
> systems easier.  But how does that work?
>

Dave gave an outline.  I'm liking this.  What are the downsides, if any?


> 6) Adding ".js" as the default resolution strategy:
>

Dave responded that a custom resolution hook would be required for
resources that don't end in ".js".  While that certainly works for current
loader libraries, can we really mandate a "js" extension for all module
URLs, forever?  Because this default will effectively mandate that.
 Imagine if such a mandate came from CSS.  URLs are a backbone concept of
the internet and we shouldn't go fiddling with it.

Dave also responded:

> "I'll wait till it's fleshed out more" didn't last long, eh? ;-) Anyway,
I don't really
> understand this argument but do you think there's much value to a
philosophical
> debate on es-discuss?

Well, I practice Olympian levels of patience with my four small children
day in and day out, so you'll have to forgive me if I've got none left over
for you, good sir. ; )

- Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121206/a774db54/attachment-0001.html>


More information about the es-discuss mailing list