On Mon, Jun 9, 2014 at 7:40 PM, Karolis Narkevičius <karoli...@gmail.com>
wrote:

> Why can't we have both with the same syntax?
>
> ```js
> // imports a function which is the default export
> import mkdirp from "mkdirp";
> ```
>
> and
>
> ```js
> // imports all named exports, like module used to
> import fs from "fs";
> ```
>

According to the spec [1] (IIUC) you can import both all/some of the named
export values and the default export value, due to the second option of the
ImportClause:

```
ImportClause :
  ImportedBinding
  ImportedBinding , NamedImports
  NamedImports
```

Does this mean that a module can export both a default value and several
named values? If so, libraries like Underscore would need to use both
namedExport and defaultExport to suite all users.
Or would the default value be an object containing all the named export
values? If so, it seems like your suggestion is already in the spec.


[1]: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to