Kevin Smith (2013-04-16T13:06:37.000Z)
github at esdiscuss.org (2013-07-12T02:26:56.825Z)
Currently, curly braces are used within import and export declarations: ```js import { something } from "url"; import { something: renamed } from "url"; import { a, b, c } from "url"; export { something }; export { renamed: something }; export { a, b, c }; ``` The `import` and `export` curlies are analogies for destructing and object literal syntax, respectively. This analogy is problematic for the following reasons: 1) Destructuring declarations create new variables, whereas import declarations create aliases for existing variables. This distinction is subtle and can lead to misunderstandings about module semantics. 2) Beginners tend to get the "direction" of renaming wrong with destructuring syntax: ```js let { myX: x } = { x: "value" }; // Oops! ``` Since destructuring is an intermediate to advanced feature, it's not a big problem in that context. But importing is one of the most basic features in the language. We don't want to have a stumbling block right at the front door. 3) Curly braces within export declarations suggest a false semantics in which an object literal expression can be exported: ```js // Since is ok: export { exportedA: a }; // It leads one to believe that this is ok: export { exportedA: "some-value" }; ``` Given those considerations, I think we should find a curly-free syntax for import and export declarations. Here is a proposal: ```js import something from "url"; import something as renamed from "url"; import a, b, c from "url"; export something; export something as renamed; export a, b, c; ``` In the above syntax, "as" becomes the unified keyword for renaming module bindings. For an analysis of the ASI issues, see: https://gist.github.com/zenparsing/5395635