A question about module/imports/exports

Shijun He hax.sfo at gmail.com
Sun Aug 26 13:05:18 PDT 2012


Hi, I'm writing a library for ES5 to add module system like ES6, I
just want to confirm some behaviors of ES6 module system:

module A {
  export var a = 'a'
  export function changeA(v) {
     a = v
  }
}

module B {
  import * from A
  console.log(a) // 'a'
  changeA('a1')
  console.log(a) // 'a' or 'a1' ?
}

Current CommonJS/AMD module system only can return 'a', but I guess
ES6 should return 'a1'?

And is there any difference if module A is write as:

module A {
  var _a = 'a'
  export function changeA(v) {
     a = v
  }
  export {a: _a}
}


Thank you!


--
hax


More information about the es-discuss mailing list