Module syntax

Kevin Smith zenparsing at
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";

Just throwing an idea out...

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list