simpler, sweeter syntax for modules

John J Barton johnjbarton at johnjbarton.com
Wed Mar 21 21:28:37 PDT 2012


On Wed, Mar 21, 2012 at 9:01 PM, Axel Rauschmayer <axel at rauschma.de> wrote:
> I like variant B, because it follows the rules:
> - "module" => define a module
> - "import" => extract something out of a module
>
> But I would use a keyword instead of "=" (due to the reason that you mentioned). Compare:
>
>     module Bar = "bar.js";
>     module Bar is "bar.js";
>     module Bar from "bar.js";
>     module Bar in "bar.js";
>     module Bar via "bar.js";
>
> I’m not entirely happy with either one of these keywords, but they all seem better to me than the equals sign. So any other keyword is fine by me, really.


equals makes sense when it is assigment:

   module Bar = load("bar.js");

jjb


>
> On Mar 22, 2012, at 2:35 , David Herman wrote:
>
>> Follow-up: I've factored out these two alternative approaches, both of which I think are defensible.
>>
>> Grammars:
>>
>>    http://wiki.ecmascript.org/doku.php?id=harmony:modules#syntax
>>
>> Simple examples:
>>
>>    http://wiki.ecmascript.org/doku.php?id=harmony:modules#external_module_load
>
> --
> 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


More information about the es-discuss mailing list