ModuleImport

C. Scott Ananian ecmascript at cscott.net
Thu Jun 26 08:56:23 PDT 2014


On Thu, Jun 26, 2014 at 10:50 AM, Russell Leggett <russell.leggett at gmail.com
> wrote:

> To me, though, that goes back to the destructuring/not destructuring
> aspect. Maybe this has floated by during the bikeshedding, but why not
> something like:
>
>     //import a single named export
>     import foo from "bar";
>
>     //import multiple named exports
>     import foo, baz from "bar";
>
>     //alias an imported named export
>     import foo as fooAlias from "bar";
>
>     //import the module
>     import "bar" as bar;
>

I like the fact that this doesn't look like destructuring, since variable
binding is different from destructuring assignment.  Could
```
import foo, baz from "bar" as bar;
```
allowed simultanous import of named exports and the module itself?  If so,
the grammar gains a pleasing regularity.

OTOH, I think this syntax reorganization is orthogonal to some of the other
issues discussed.  In particular, your latter proposal still allows for
user confusion between:
```
import _ from "underscore";
import "underscore" as _;
```
The various proposals seem to try to address this by making these
semantically identical (or near-identical, with some cooperation from the
module author).
 --scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140626/c6f2011f/attachment.html>


More information about the es-discuss mailing list