David Bruant wrote:
Le 26/06/2012 16:44, David Bruant a écrit :
Also relevant to this thread, post on the same topic by Isaacs (node.js lead) : http://blog.izs.me/post/25906678790/on-es-6-modules
"Furthermore, |let| already gives us destructuring assignment. If a module exports a bunch of items, and we want several of them, then do |var {x,y,z} = import 'foo'| or some such." => Excellent idea. That combined with the single export idea reduces the amount of new syntax to introduce.

Declarations can nest under control flow constructs, but import or module dependencies must be prefetched. They're static.

  if (some_rare_condition()) { let x = import "m"; ... }

either always prefetches "m", which does not say what is meant; or it nests an event loop, violating run-to-completion, which is not going to happen.

The Module proposal has a local renaming feature which I think should be kept:
Initial proposal:
    import { draw: drawShape } from shape;
    import { draw: drawGun } from cowboy;
Could become:
    let {draw: drawShape} = import './shape.js'
    let {draw: drawGun} = import './cowboy.js'

I would actually reverse the order:
    let {drawShape: draw} = import './shape.js'
    let {drawGun: draw} = import './cowboy.js'
But that's a matter of taste.

No, you can't so reorder, it's not a matter of taste. Destructuring is the dual <http://en.wikipedia.org/wiki/Dual_%28category_theory%29> of structuring.

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

Reply via email to