Closed GeorgNeis closed 7 years ago
Great catch, thank you. I wonder why the spec creates [[Namespace]] lazily.
@domenic the reason why it is created lazily is because we don't need the namespace object for most modules, we only really needed when:
a. a module is imported by other module via import * as x ...
b. a module is imported via import()
the rest of the graph is connected via the bindings in the env rec associated to the module record.
That feels like it'd be better left as an implementation optimization instead of coded into the spec, but it works either way.
In
FinishDynamicImport
,moduleRecord.[[Namespace]]
will in most cases still beundefined
. I suppose you want to explicitly callGetModuleNamespace
to force the creation of the namespace object.