Module syntax

Kevin Smith zenparsing at gmail.com
Wed Jun 5 11:51:18 PDT 2013


It occurs to me that this is valid under the current grammar:

    import { default as foo } from "foo";
    export { foo as default };

We've discussed using a well-known symbol for the default export, but this
simple desugaring might be another option:

    import foo as "foo";
    // => import { default as foo } from "foo";

    export default = expr;
    // => let __genident__ = expr; export { __genident__ as default };

This would provide easy access to the default export on a module instance
object without having to obtain a reference to a symbol.

    module Foo from "foo";
    F.default();

Just throwing an idea out...

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


More information about the es-discuss mailing list