Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

[WIP] Top-level await integration #71

Closed
wants to merge 2 commits into from

Conversation

littledan
Copy link
Member

The purpose of this patch is to nail down how dynamic import would
adjust to the needs of top-level await. The relevant change is,
the module.Evaluate() method will return a Promise that resolves
when the module is ready, and this will be passed to
FinishDynamicImport to wait on before resolving the Promise it returns.

This PR is just a sketch, not to be landed. For one, the "Upon fulfillment"
language will need to be changed to be more ECMASpeak-like. Top-level
await should also reach stage 3 before this change lands.

The PR where Evaluate returns a Promise is
guybedford/proposal-top-level-await#1

@littledan
Copy link
Member Author

Twin HTML PR whatwg/html#4352

spec.html Outdated
@@ -70,7 +70,7 @@ <h1><ins>Runtime Semantics: HostImportModuleDynamically ( _referencingScriptOrMo

<dd>
<ul>
<li>At some future time, the host environment must perform FinishDynamicImport(_referencingScriptOrModule_, _specifier_, _promiseCapability_, NormalCompletion(*undefined*)).</li>
<li>At some future time, the host environment must perform FinishDynamicImport(_referencingScriptOrModule_, _specifier_, _promiseCapability_, Promise.resolve(*undefined*)).</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would probably need to be specified in terms of an abstract op (like PromiseResolve) rather than a global lookup

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, there's no intention of anyone doing such a dynamic lookup. This should not be taken literally.

@littledan
Copy link
Member Author

Unnecessary with the current phrasing of whatwg/html#4352 . (The logic is extremely trivial either way, as you can see from that patch, so I don't think there's much for us to pull back here into JS.)

@littledan littledan closed this Apr 8, 2019
@littledan
Copy link
Member Author

Reopening, as I'm reverting that patch.

@littledan littledan reopened this May 19, 2019
littledan and others added 2 commits June 24, 2019 16:00
The purpose of this patch is to nail down how dynamic import would
adjust to the needs of top-level await. The relevant change is,
the module.Evaluate() method will return a Promise that resolves
when the module is ready, and this will be passed to
FinishDynamicImport to wait on before resolving the Promise it returns.

This PR is just a sketch, not to be landed. For one, the "Upon fulfillment"
language will need to be changed to be more ECMASpeak-like. Top-level
await should also reach stage 3 before this change lands.

The PR where Evaluate returns a Promise is
guybedford/proposal-top-level-await#1
@codehag
Copy link

codehag commented Apr 6, 2021

This was merged into the TLA spec, closing here

tc39/proposal-top-level-await#148

@codehag codehag closed this Apr 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants