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

Revert #20 and do not await async inputs’ values without mapping ƒ #27

Merged
merged 3 commits into from
Jul 12, 2022

Conversation

js-choi
Copy link
Collaborator

@js-choi js-choi commented Jul 11, 2022

Resolves #19.
See #19 (comment).

The intent is to match the behavior of for await and iterator-helpers’ AsyncIterator.prototype.toArray.

spec.html Outdated Show resolved Hide resolved
spec.html Outdated
@@ -74,10 +74,10 @@ <h1><ins>Array.fromAsync ( _asyncItems_ [ , _mapfn_ [ , _thisArg_ ] ] )</ins></h
1. If _mapping_ is *true*, then
1. Let _mappedValue_ be Call(_mapfn_, _thisArg_, &laquo; _nextValue_, 𝔽(_k_) &raquo;).
1. IfAbruptCloseAsyncIterator(_iteratorRecord_, _mappedValue_).
1. Set _mappedValue_ to Await(_mappedValue_).
1. IfAbruptCloseAsyncIterator(_iteratorRecord_, _mappedValue_).
1. Set _mappedValue_ to _mappedValue_.[[Value]].
Copy link
Contributor

Choose a reason for hiding this comment

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

IfAbruptCloseAsyncIterator already does this. (It's a macro.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just to be clear, is the suggestion to remove all three of the highlighted lines? I’m rechecking the definition of IfAbruptCloseAsyncIterator, and it does seem to take care of unwrapping mappedValue into its [[Value]]—but I don’t see where it Awaits mappedValue beforehand.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just the Set _mappedValue_ to _mappedValue_.[[Value]] line specifically, sorry.

Copy link
Contributor

@bakkot bakkot left a comment

Choose a reason for hiding this comment

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

LGTM other than comments.

js-choi and others added 2 commits July 12, 2022 00:48
IfAbruptCloseIterator already takes care of this.
@js-choi js-choi merged commit facec4c into main Jul 12, 2022
@js-choi js-choi deleted the revert-20 branch July 12, 2022 05:27
@js-choi js-choi mentioned this pull request Jul 12, 2022
5 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 13, 2023
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.

Should it await next.value when not passing a mapper function?
2 participants