Skip to content

Editorial: add a note about synchronicity of SyntheticModule Evaluate #3640

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

legendecas
Copy link
Member

It is not clear if a Synthetic Module's [[EvaluationSteps]] should be sync or not by reading the steps in Synthetic Module's Evaluate algorithm solely.

The synchronicity of a Synthetic Module's Evaluate steps is asserted in EvaluateModuleSync.

Add a note at Synthetic Module Evaluate abstract operation about the synchronicity.

@legendecas legendecas force-pushed the synthetic-module-evaluate branch 2 times, most recently from 6f066a8 to 896bce8 Compare July 9, 2025 10:00
spec.html Outdated
@@ -28871,6 +28871,10 @@ <h1>Evaluate ( ): a Promise</h1>
1. Perform ! Call(_pc_.[[Resolve]], *undefined*, « *undefined* »).
1. Return _pc_.[[Promise]].
</emu-alg>

<emu-note>
<p>The returned promise should always be settled. In InnerModuleEvaluation, a non Cyclic Module Record is evaluated with EvaluateModuleSync, and asserted to return a settled promise.</p>
Copy link
Member

Choose a reason for hiding this comment

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

That the returned promise here is always settled is obvious, because the second-to-last line calls Call(_pc_.[[Resolve]], *undefined*, « *undefined* »).

However, what we should do is enforce that all non-Cyclic module records must always return a settled promise. I suggest doing it in the Evaluate description at https://tc39.es/ecma262/#table-abstract-methods-of-module-records, so that if hosts provide their own module types they must also follow that requirement.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, updated!

@legendecas legendecas force-pushed the synthetic-module-evaluate branch from 896bce8 to 055d4e6 Compare July 30, 2025 14:03
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.

2 participants