Skip to content

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
</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
<td>
<p>Returns a promise for the evaluation of this module and its dependencies, resolving on successful evaluation or if it has already been evaluated successfully, and rejecting for an evaluation error or if it has already been evaluated unsuccessfully. If the promise is rejected, hosts are expected to handle the promise rejection and rethrow the evaluation error.</p>
<p>Link must have completed successfully prior to invoking this method.</p>
<p>A non Cyclic Module Record must always returns a settled promise. This is asserted in InnerModuleEvaluation, and a non Cyclic Module Record is evaluated with EvaluateModuleSync.</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p>A non Cyclic Module Record must always returns a settled promise. This is asserted in InnerModuleEvaluation, and a non Cyclic Module Record is evaluated with EvaluateModuleSync.</p>
<p>A non Cyclic Module Record must always returns a settled promise.</p>

From a host point view the only thing that matters is what they have to do, and not what algorithms would break if they don't. Similarly, for "Link must have completed successfully prior to invoking this method" we do not say that that's asserted in step 2 of Evaluate.

(and if we do need to link, we should do it so through <emu-xref> so that it stays up to date)

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