ModuleImport

Russell Leggett russell.leggett at gmail.com
Fri Jun 27 07:05:04 PDT 2014


On Fri, Jun 27, 2014 at 3:52 AM, Michał Gołębiowski <m.goleb at gmail.com>
wrote:

> On Fri, Jun 27, 2014 at 9:44 AM, Russell Leggett <
> russell.leggett at gmail.com> wrote:
>>
>> No, that example would be:
>>
>>     import "mkdirp" as mkdir;
>>
>> Its actually shorter than node.
>>
>
> But in current proposal the module object cannot be a function from what I
> understand. So you'd have to create a named export and import it as I wrote.
>
>
Ok, so can I just ask a serious question. I looked at the mkdirp library,
and in their own documentation, they use:

    var mkdirp = require('mkdirp');
So let's say in the new world order, no default exports, this is a named
export mkdirp. Is it *really* that bad a thing to just use the name they
chose for their API? I mean what about all of the likely cases of exporting
a class. Would you advocate for those classes to be aliased before use?
What about methods? Those are typically unchanged. The argument has been
made that without default exports, library users would then have to known
the name of the exported member. Is that really a serious complaint? You
*have* to know what everything else is called, what parameters are
expected, etc. I would go as far as to say that either 1 of 2 things is
happening.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140627/a8fdaaa4/attachment.html>


More information about the es-discuss mailing list