simpler, sweeter syntax for modules

Axel Rauschmayer axel at rauschma.de
Wed Mar 21 21:01:48 PDT 2012


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.

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



More information about the es-discuss mailing list