Why can't we have this?

```js
// when only default exports are used
// import that one function
import mkdirp from "mkdirp";

// when only named exports are used
// import it like a module
import fs from "fs";

// when both named and default exports are used
// this imports the default export
import when from "when";
// and the named ones can only be imported via
import {all, map} from "when";
```

This way modules with one export work well and bags of utilities also work
well. The third case is a little trickier but it's not much worse compared
to how it would have been with a ModuleImport syntax, since if you want to
use both default export and named exports in the same file you would end up
with something like this:

```js
module whenModule from "when";
import when from "when";

whenModule.map([when(foo), when(bar)]);
```

So ideally it should be possible to do

```js
import when from "when";
import {all} from "when";
// when is a function and also has named exports attached
when.map([when(this)]);
all(promises);
```
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to