Module Comments

Kevin Smith khs4473 at gmail.com
Thu Dec 6 08:33:31 PST 2012


> The downside is that it introduces a severe anomaly into the module
> semantics (a module which actually has no instance). I could live with
> this feature if we were to find a way to explain it in terms of simple
> syntactic sugar on both the import and export side, but screwing and
> complicating the semantics for minor syntactic convenience is not
> something I am particularly fond of.
>

What if this:

    export = "boo";

Actually creates a static export with some exotic name, say __DEFAULT__
(for the sake of argument) and initializes it to the value "boo".

And this form:

    import boo from "boo.js";

Creates a binding to __DEFAULT__ in "boo.js", if it exists, or to the
module instance of "boo.js" otherwise.

Would that work as a desugaring?

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


More information about the es-discuss mailing list