module exports
John Barton
johnjbarton at google.com
Fri Mar 14 09:20:35 PDT 2014
On Fri, Mar 14, 2014 at 9:15 AM, Rick Waldron <waldron.rick at gmail.com>wrote:
>
>
>
> On Fri, Mar 14, 2014 at 11:04 AM, Kevin Smith <zenparsing at gmail.com>wrote:
>
>>
>>>
>>> Because it doesn't allow for the Assignment Expression form
>>> (specifically, function expressions) that developers expect to be able to
>>> write:
>>>
>>> export default function() {}
>>>
>>
>> The alternative here is:
>>
>> function MyThing() {}
>> export { MyThing as default };
>>
>> Which is more clear, more readable,
>>
>
> I think it's fair to say that these are subjective claims.
>
Indeed, and subjectively I agree with Kevin.
>
>
>> and barely less ergonomic. If you *really* want the AssignmentExpression
>> form, you've got to put the equals in there.
>>
>
> I don't understand this claim, any legal AssignmentExpression form is
> allowed.
>
>
>> I've said this before, but without the equals it looks too much like a
>> declaration:
>>
>> export default class C {}
>> var c = new C(); // No C defined, WTF?
>>
>
> Why is this surprising?
>
It is surprising because it looks like it should work like
export class C {}
The keyword 'default' looks like a modifier like 'const'.
>
> If a developer knows how named function expression bindings work today,
> this won't be a big surprise.
>
I know how named function expressions work and it's still surprising.
jjb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140314/7225a5a0/attachment-0001.html>
More information about the es-discuss
mailing list