Modules: Curly Free

Quildreen Motta quildreen at gmail.com
Mon Apr 22 07:45:23 PDT 2013


Andreas is suggesting we adopt a convention or "design pattern" for
anonymous exports. Dave is suggesting that it should be supported at the
syntax level, so you get language-level guarantees rather than wishful
thinking.


On 22 April 2013 11:24, Axel Rauschmayer <axel at rauschma.de> wrote:

> 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
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
--
Quildreen "Sorella" Motta  (http://killdream.github.com/)
— JavaScript Alchemist / Minimalist Designer —
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130422/120ee9f7/attachment-0001.html>


More information about the es-discuss mailing list