Modules: Curly Free

Axel Rauschmayer axel at rauschma.de
Mon Apr 22 07:24:59 PDT 2013


> Andreas Rossberg wrote:
>> Just to be clear, what I suggested was having a single global
>> convention for the name of the 'anonymous' export in every module, say
>> ,"it". No need to know the "internals" of anything. Your Node example,
> 
> You are imposing a tax on everyone using modules and anonymous export, today a large base of users (modules are predominately anonymous export by counting NPM modules).

Is there a way to be explicit about what the tax actually is? Andreas’ convention looks like this:

     export let it = someValue;
     import it as foo from "foo";

If you replace "it" with "default", you *almost* get David Herman’s proposal, which looks like this:

     export default someValue;
     import default foo from "foo";

The advantage of the latter is that you get a static check for syntactic correctness, right? I don’t see any other advantage (but that may be enough of an advantage).

Axel

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130422/0fc240f0/attachment.html>


More information about the es-discuss mailing list