On Oct 17, 2012, at 9:09 AM, Sam Tobin-Hochstadt wrote:
> On Wed, Oct 17, 2012 at 9:51 AM, Kevin Smith <[email protected]> wrote:
>>
>>> Do we log "you need me" only when f is called for the first time?
>>
>>
>> Sorry - that makes no sense. What I meant was:
>>
>> module A {
>> console.log("you need me");
>> export var x = "x";
>> }
>>
>> export function f() {
>> console.log(A.x);
>> }
>>
>> Do we log "you need me" only when f is called for the first time?
>
> I think that would be far to hard to understand. Instead, we should
> treat a module with a reference like `A.x` to an unimported module as
> if it implicitly had an import of `A`, so "you need me" would be
> logged as soon as the surrounding module was imported, even if `f` is
> never called.
> --
Is the reference to A required to get the implicit import and hence implicit
initialization? For example in:
module Outer {
/* no export */ module A {
console.log("you need me");
export var x = "x";
}
export function f() {
console.log("no reference to A");
}
}
I would expect inner modules to always be initialized when their outer module
is initialized
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss