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

add warning to Iterators.filter about assumptions on predicate #50497

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

adienes
Copy link
Contributor

@adienes adienes commented Jul 10, 2023

addresses #50440

@adienes
Copy link
Contributor Author

adienes commented Aug 5, 2023

bump

@brenhinkeller brenhinkeller added docs This change adds or pertains to documentation iteration Involves iteration or the iteration protocol labels Aug 6, 2023
Comment on lines 495 to 497
The implementation may assume that `flt` is pure, so please use caution
to ensure correctness when the predicate values may be non-deterministic,
have side-effects, or be dependent on the order of iteration.
Copy link
Member

@timholy timholy Aug 7, 2023

Choose a reason for hiding this comment

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

Can we be more specific about the types of problems that might be encountered? "Please use caution" might be OK for a sign that starts with "Ice forms on bridge, please use caution" but in this context it's not obviously actionable advice. Maybe something like "Predicates that are non-deterministic, ... may not compose well with other operations. In such cases, Base.filter is recommended instead."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, reworded

@adienes adienes force-pushed the iterator_flt_warning branch from 17b9c4b to 689ae53 Compare August 7, 2023 12:33
@adienes adienes force-pushed the iterator_flt_warning branch from 689ae53 to 922732b Compare August 7, 2023 12:38
@timholy timholy merged commit 8b5e3e9 into JuliaLang:master Aug 7, 2023
@timholy
Copy link
Member

timholy commented Aug 7, 2023

Very nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation iteration Involves iteration or the iteration protocol
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants