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

Make Combinations lazy #795

Merged

Conversation

Philippe-Cholet
Copy link
Member

Related to #792

To make the Combinations adaptor lazy, the operation "prefill the lazy buffer" is now done when handling the first element rather than at definition.

However, the value returned by the n method is changed when called on a fresh it.combinations(k) since the "prefill" operation was delayed. I'm perplex on why the method n was made public in the first place as the value is subject to change (said in its documentation). But it is public and this change is therefore a (small) breaking one, right?

@Philippe-Cholet Philippe-Cholet added this to the next milestone Nov 5, 2023
To make the `Combinations` adaptor lazy, the operation "prefill the lazy buffer" is now done when handling the first element rather than at definition.

However, the value returned by the `n` method is changed when called on a fresh `it.combinations(k)` since the "prefill" operation was delayed.
I'm perplex on why the method `n` was made public in the first place as the value is subject to change (said in its documentation). But it is public and this change is therefore a breaking one.
Copy link
Member

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

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

Having given this a few days of thought, I don't think this qualifies as a breaking change. Yes, the observable behavior changes. But that's also true even without this method, and we haven't been considering our other lazy-ification efforts to be breaking changes (rather, they're really bugfixes).

@jswrenn jswrenn added this pull request to the merge queue Nov 6, 2023
Merged via the queue into rust-itertools:master with commit 63d139d Nov 6, 2023
8 checks passed
@Philippe-Cholet Philippe-Cholet deleted the combinations-laziness branch November 6, 2023 22:02
@jswrenn jswrenn mentioned this pull request Nov 14, 2023
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

Successfully merging this pull request may close these issues.

2 participants