simpler, sweeter syntax for modules

David Herman dherman at mozilla.com
Wed Mar 21 23:22:44 PDT 2012


On Mar 21, 2012, at 9:41 PM, Brendan Eich wrote:

> Perhaps Python has the right syntax, then?
> 
> from "foo.js" import foo;
> import "foo.js" as Foo;

I suppose we could. I always thought this was an awkward choice on Python's part. The first line always reminds me of the Yinglish constructions my grandma used to joke about from her childhood ("cut me up and butter me and throw me down the baby a piece of bread!").

> 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.

The thing is, I just don't really see the argument against the bound variable being on the RHS. It reads perfectly naturally:

    import "foo.js" as foo;

I don't see anything hard to follow about that. There's no possible alternative meaning you could ascribe to it than the right one.

Dave



More information about the es-discuss mailing list