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

Support iterable type for all() + race() + any() #225

Merged
merged 2 commits into from Jun 13, 2022

Conversation

clue
Copy link
Member

@clue clue commented Jun 10, 2022

This changeset adds support for the iterable type for all() + race() + any(). Instead of only accepting an array, each function now also accepts instances implementing Traversable such as Iterator and Generator instances.

This is a pure feature addition that does not break BC. With these changes applied, our API is also pretty much identical to ES6 promises commonly used in JavaScript.

The first commit highlights how this is essentially only a new type definition and a call to iterator_to_array(). The second commit then takes advantage of a more iterative approach that uses less memory and also supports consuming infinite iterators if the resulting promise settles. The test suite confirms this has 100% code coverage.

Resolves #221
Builds on top of #149, #35, #83, #219 and others

@clue clue added this to the v3.0.0 milestone Jun 10, 2022
@clue clue requested review from jsor and WyriHaximus June 10, 2022 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow iterable instead of array for all(), race() and any()
3 participants