Single import from modules without default export

Marius Gundersen gundersen at gmail.com
Wed Aug 6 04:56:11 PDT 2014


On Wed, Aug 6, 2014 at 1:02 PM, Kevin Smith <zenparsing at gmail.com> wrote:

>
>>  * The name of the imported binding is decided by the user of the module,
>> not the author
>>  * The user of the module does not need to know the name of the exported
>> binding, set by the author of the module.
>>
>
> If you seriously want to make these claims, you need to respond to
> http://esdiscuss.org/topic/quantifying-default-exports .
>
>
 Sorry, I don't understand what you mean. I'm merely stating that using
`import a from "module"` lets the user of the module decide on the name
without needing to know what the author of the imported module named it. I
remember you made the claim that:

> This argument is unsound, since the user always has to know the API of the
> source module before use, regardless of whether or not default exports are
> used.
>
But there is still the advantage that the user of the module can name it
whatever they want with fewer keystrokes.


>
>> I therefore want to propose that the default keyword is removed, that
>> only named bindings are allowed when exporting in a module, and that method
>> A imports the first named binding.
>>
>
> That would mean that simply moving a function definition around within a
> module would break clients.  Ouch!
>
>
Yes, but only if you swap around the first export with something else. Not
sure how large of a problem this is though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/fabb4f4d/attachment.html>


More information about the es-discuss mailing list