Skip to content
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

Redefine fromAsync as “built-in async function” #43

Open
js-choi opened this issue Nov 1, 2023 · 1 comment
Open

Redefine fromAsync as “built-in async function” #43

js-choi opened this issue Nov 1, 2023 · 1 comment

Comments

@js-choi
Copy link
Collaborator

js-choi commented Nov 1, 2023

After #36 was merged, Array.fromAsync spec now depends on tc39/ecma262#2942, just like proposal-async-iterator-helpers.

@bakkot points out that the current spec uses AsyncFunctionStart directly rather than defining Async.fromAsync as a “built-in async function”, which is a new concept defined by tc39/ecma262#2942. (The current spec version still does require tc39/ecma262#2942’s enhancement of AsyncFunctionStart.

We probably should define Async.fromAsync as a “built-in async function object”.

Note that tc39/ecma262#2942 (comment) suggests that the final form of tc39/ecma262#2942 might still not be completely settled.

@js-choi js-choi mentioned this issue Nov 1, 2023
5 tasks
@js-choi
Copy link
Collaborator Author

js-choi commented Dec 2, 2023

As far as I can tell, all this change requires is removing steps 1, 2, 3, 4, and 5, replacing them all with the sub-steps of step 3. tc39/ecma262 seems to cause Array.fromAsync to implicitly be defined as a built-in async function object, whose [[Call]] method automatically creates a PromiseCapability and Abstract Closure, performs AsyncFunctionStart on them, and returns the resulting promise from PromiseCapability.

I will make a pull request for these changes after #44 is reviewed and merged.

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

No branches or pull requests

1 participant