Module syntax

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


if

```
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 gmail.com> 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 mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130603/1eccd224/attachment-0001.html>


More information about the es-discuss mailing list