On Wed, Oct 17, 2012 at 10:10 AM, David Herman <[email protected]> wrote:
> Concrete example: Even and Odd modules refer to each other, but the import
> statements occur after some initialization:
>
> module Odd {
> export let odd = function(x) {
> return x === 0 ? false : !even(x - 1);
> }
> import even from Even; // force execution of Even here, if it hasn't
> already
> export let b = odd(17);
> }
> module Even {
> export let even = function(x) {
> return x === 0 || !odd(x - 1);
> }
> import odd from Odd; // force execution of Odd here, if it hasn't
> already
> export let b = even(17);
> }
> console.log(Odd.b);
>
What about this?
module Odd {
import even from Even; // force execution of Even here, if it
hasn't already
export let odd = function(x) {
return x === 0 ? false : !even(x - 1);
}
export let b = odd(17);
}
module Even {
import odd from Odd; // force execution of Odd here, if it
hasn't already
export let even = function(x) {
return x === 0 || !odd(x - 1);
}
export let b = even(17);
}
console.log(Odd.b);
I guess this doesn't work...
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss