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

Sharing machinary with iterator-helpers toArray #23

Open
benjamingr opened this issue Jan 17, 2022 · 4 comments
Open

Sharing machinary with iterator-helpers toArray #23

benjamingr opened this issue Jan 17, 2022 · 4 comments
Labels
question Further information is requested

Comments

@benjamingr
Copy link

Hey, I was wondering, since Array.fromAsync(iter) is similar to AsyncIterator.from(iter).toArray() wouldn't it make sense if they shared the same spec text? That is one (for example fromAsync) is defined and the other is defined in terms of it?

(I agree that it makes sense to have both as it's more ergonomic and people will likely reach out to both - though that's not the discussion here)

@ljharb
Copy link
Member

ljharb commented Jan 17, 2022

Certainly it'd be ideal if they shared steps via abstract operations, but that'd likely happen after one of them had landed in the main spec.

@benjamingr
Copy link
Author

That sounds reasonable to me.

@zloirock
Copy link
Contributor

For sharing this logic, this difference should be resolved tc39/proposal-iterator-helpers#168. At this moment, core-js use one internal operation for them.

@js-choi
Copy link
Collaborator

js-choi commented Jan 17, 2022

We will discuss this issue (as well as #19 and tc39/proposal-iterator-helpers#168) when we present this proposal for Stage 3 at the upcoming plenary meeting.

We could try isolating the algorithm into its own abstract operation soon in anticipation of iterator-helpers. It’s just an editorial thing.

Related: #1, #19, tc39/proposal-iterator-helpers#36, tc39/proposal-iterator-helpers#142, tc39/proposal-iterator-helpers#156.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants