github at esdiscuss.org (2013-07-12T02:26:06.504Z)
On Dec 28, 2012, at 9:39 AM, Domenic Denicola <domenic at domenicdenicola.com> wrote:
> On Dec 28, 2012, at 12:28, "David Herman" <dherman at mozilla.com> wrote:
>
>> Another example where this could come up is initialization. Since imports tend to be at the beginning of a module, you could end up reading the value of a not-yet-initialized variable too soon.
>
> A code example of this would be awesome. Also, is it a problem ES5 module systems fail to address?
It can come up with mutual recursion between modules, which ES5 module systems famously handle poorly. Here's an example, untested, obviously :)
```js
// a.js
import { B } from "b";
export class A {
m() { return new B }
}
// b.js
import { A } from "a";
export class B {
m() { return new A }
}
```
On Dec 28, 2012, at 9:39 AM, Domenic Denicola <domenic at domenicdenicola.com> wrote: > On Dec 28, 2012, at 12:28, "David Herman" <dherman at mozilla.com> wrote: > >> Another example where this could come up is initialization. Since imports tend to be at the beginning of a module, you could end up reading the value of a not-yet-initialized variable too soon. > > A code example of this would be awesome. Also, is it a problem ES5 module systems fail to address? It can come up with mutual recursion between modules, which ES5 module systems famously handle poorly. Here's an example, untested, obviously :) // a.js import { B } from "b"; export class A { m() { return new B } } // b.js import { A } from "a"; export class B { m() { return new A } } Dave