Andreas Rossberg (2012-12-28T16:18:36.000Z)
github at esdiscuss.org (2013-07-12T02:26:06.491Z)
Your expectations must be different than mine. :) Dave and Sam may have a different answer, but I'd answer that the aliasing semantics follows from a module system's role as (among other things) a name spacing mechanism. That implies two axioms: 1. You should always be able to access an export under its qualified or unqualified name, with the same meaning. That is, ```js M.a = 5; ``` and ```js import a from M; a = 5; ``` should have the same meaning. 2. You should always be able to wrap existing code into a module without changing its meaning. That is, given ```js let a = 4; // ... a = 5; ``` it should be possible to refactor 'a' (plus other declarations) into a module without changing the meaning of use sites, like: ```js module M { export let a = 4; // ... } // ... import a from M; a = 5; ``` I think that the loss of either of these properties would make modules far more surprising, and refactoring code into modules harder and more error-prone. I wouldn't worry too much about current source-to-source compilers for ES6 not getting this right yet. That is mainly due to the lack of a detailed specification. I could enumerate quite a few other fundamental things that they don't have right yet (e.g. recursive linking, static checking, etc.). However, I agree that the destructuring syntax for module imports may not be the clearest choice in terms of raising the right expectations. (As we have discovered already, it has other issues, namely people confusing the direction of renaming.) Maybe it is a bit too clever, and considering alternatives a worthwhile idea.