Module syntax

Kevin Smith zenparsing at gmail.com
Mon Jun 3 13:03:26 PDT 2013


> `export default` is perfect IMO. It also conceptually fits better with how
> default exports work. (I.e., they're *default* exports, they're not the
> entirety of the exports. They don't overwrite the module instance object,
> in the fashion that `module.exports =` does.)
>
>
A potential problem with `export default` is that there is very little to
signify (to humans) that we are entering an expression context.  For
example, the following "looks like" a declaration with a modifier, but it's
not.

    export default function x() {}
    x(); // ReferenceError!

It might be better to clearly indicate the expression context by a "=" or
something similar.

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


More information about the es-discuss mailing list