simpler, sweeter syntax for modules
brendan at mozilla.org
Wed Mar 21 21:42:58 PDT 2012
David Herman wrote:
> On Mar 21, 2012, at 3:44 PM, Luke Hoban wrote:
>> > Great to see the updates. A couple of questions:
>>>> >>> import "foo.js" as Foo;
>>>> >>> import foo from "foo.js";
>>>> Andreas also didn't like the inversion of order. I came to this because earlier versions of the syntax were inconsistent about whether `from` meant the-module-itself or an-export-of-the-module, which made it even more confusing. This new syntax was inspired by Python, but with `import` as the leading keyword, rather than `from`. Which is what leads to the inversion of order.
Perhaps Python has the right syntax, then?
from "foo.js" import foo;
import "foo.js" as Foo;
I'm not wed to any syntax but if the only problem is the swapping of
imported export patterns and the module reference or MRL, then we could
fix that just as Python did.
More information about the es-discuss