Module syntax

Andrea Giammarchi andrea.giammarchi at
Mon Jun 3 13:17:47 PDT 2013


function x() {}
export default x;

works thought, that ain't any different from returning function expression
where you cannot reuse that function if not inside the function itself.

It does not look like a big lost but more similar to expression logic we
are use to with JS ... or, is it?

On Mon, Jun 3, 2013 at 1:03 PM, Kevin Smith <zenparsing at> wrote:

> `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 }
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list