Skip to content

Fix return type #12

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

Merged
merged 2 commits into from
Oct 13, 2021
Merged

Fix return type #12

merged 2 commits into from
Oct 13, 2021

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Oct 13, 2021

The current spec misuses ~return~ completions. Those are use for propagating a literal syntactic return in an ES function up through any intermediate syntax (which is handled by the ? macro) to the [[Call]] AO which invoked the function, where it is unwrapped into a normal completion (in step 10.2.1 of that algorithm).

Built-in functions do not need to deal with that propagation, so they can (and do) just return a normal completion holding the value in question directly. The [[Call]] semantics for built-in functions have no corresponding return->normal unwrapping.

(The current spec text ends up propagating a return completion to the caller - that is, as currently written, it would cause a return from the code which called fromAsync.)

@js-choi js-choi merged commit 9ac7341 into tc39:main Oct 13, 2021
@bakkot bakkot deleted the patch-1 branch October 13, 2021 23:19
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 14, 2022
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.

2 participants