They curly braces only look like destructuring if you keep the name the same, when imported with a different name it's a slightly different syntax, {oldname as newname} not {oldname: newname}, also as it currently stands // BAD import lib from 'library'; lib.foo(); lib.bar();
is not correct, this was the module syntax that was removed so you could have done // ALSO BAD module lib from 'library'; lib.foo(); lib.bar(); now from what I understand the only way to do that is import 'library'; let lib = this.get('library'); On Jun 15, 2014 11:33 PM, "Axel Rauschmayer" <a...@rauschma.de> wrote: > 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 > a...@rauschma.de > rauschma.de > > > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss