I apologize for this email, but I still don’t understand the current module 
design.

**Multi-export modules.** Modules made sense to me as long as they were maps 
from names to exported values:

```js
// Module 'library'
export function foo() {
}
export function bar() {
}

// Module 'client1'
import { foo, bar } from 'library';
foo();
bar();

// Module 'client2'
import lib from 'library';
lib.foo();
lib.bar();
```

Compared to CommonJS, the syntax is nicer and less redundant. Additionally, the 
curly braces for getting stuff out of a module work, because they look like 
destructuring. And you get load-time errors if imports don’t match exports.


**Single-export modules.** Still missing is support for single-export modules, 
which could be added as follows (the keyword `default` instead of the asterisk 
works just as well, in my opinion).

```js
// Module 'MyClass'
export* class {
};

// Module 'client3'
import* MyClass from 'MyClass';
```

At the moment, it seems to me like multi-export modules and single-export 
modules are mixed in a way that makes things difficult to understand.

Axel

-- 
Dr. Axel Rauschmayer
[email protected]
rauschma.de



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to