Skip to content

Editorial: Lazily compute the list of [[Exports]] of a module namespace #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicolo-ribaudo
Copy link
Member

A goal of the proposal is that implementations can, under some circumstances, easily implement lazy loading of deferred modules (when they know that they don't have syntax errors or transitive async dependencies).

While trying to actually implement an example of that, I found a problem: even though it's not user-exposed, the spec eagerly reads the list of exports in GetModuleNamespace. It requires some non-trivial changes to actually do it lazily, and this PR does it directly in the spec so that implementations are not forced to diverge.

Collection of the list of exports in a module (for the module namespace) is now centralized in GetModuleExportsList, including removal of the "then" key for deferred namespaces.


cc @dminor. This is probably relevant for the SM implementation. I'll post an example of how to do sync lazy loading in engine262 soon.

A goal of the proposal is that implementations can, under some circumstances,
easily implement lazy loading of deferred modules (when they know that they
don't have syntax errors or transitive async dependencies).

While trying to actually implement an example of that, I found a problem: even though
it's not user-exposed, the spec eagerly reads the list of exports in GetModuleNamespace.
It requires some non-trivial changes to actually do it lazily, and this PR does it directly
in the spec so that implementations are not forced to diverge.

Collection of the list of exports in a module (for the module namespace) is now centralized
in GetModuleExportsList, including removal of the `"then"` key for deferred namespaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant