Module syntax

Dmitry Soshnikov dmitry.soshnikov at
Mon Jun 3 14:47:33 PDT 2013

On Mon, Jun 3, 2013 at 1:55 PM, Juan Ignacio Dopazo
<dopazo.juan at>wrote:

> Now that it's been decided that braces are not a form of destructuring and
> the colon replaced with `as`, what's the benefit of using braces? Why not
> this previous proposal?
> import foo as foofoo from "foo";
> import "bar" as bar;

I'm predicting thousands of "why" here once it's shipped. Users will be
asking -- what the heck is going on here?

IM(h)O, it should be just:

import bar;

And that's it.

Below are some "syntax of my dreams" (not gonna bikeshead though):

Basic imports:

1. import foo; // imports exports of module foo and binds to foo; can be
used as;
2. import "" as foo; // imports foo from external
source, can be done only via aliasing to bind name;
3. import default foo; // import the default expression from module foo.


4. import foo as myFoo;
5. import "" as myFoo; // already mentioned

Import all bindings to the current ns:

6. import * from foo; // can be used then as bar(); baz();
7. import * from "; // the same

Import some of the methods:

8. import bar from foo; // imports only bar method from foo (w/ potential
syntax ambiguity and using {})
9. import {baz, bar} from foo; // ditto, two
10. import {baz: myBaz} from foo;
11. import bar from "";

Please, please, please -- would be awesome to NOT using string names (if of
course possible):

module foo {} // doesn't matter whether it's lexical or not, but foo is
just a name

module foo/bar {} // namespaced name, OK, can be module 'foo/bar' {}

P.S.: Although, I don't like bikesheading threads and think it should be
prepared well with arguments and all implementation details before

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list