-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Short-circuiting of all on generators #19151
Comments
I think |
My memory of it is foggy, but I think that the reason why it doesn't short-circuit always is to keep things like this from happening: julia> all(Any[true,false,1]) # if short-circuiting, returns false, if not, errors out on 1 And other non-boolean hijinks. My original implementation wouldn't even have allowed generators as arguments, but things have changed in this land since then, so maybe it's time to take another look at this decision... ...? Related: #18969 |
Whether to short-circuit is a semantic choice. It should be done consistently, otherwise it's really hard to know when to expect it. My vote is also to always short-circuit.
|
@cstjean that's because So, passing |
Keep in mind that until 06c93ce |
Yes @fcard I think you're right about the type-based motivation for this. Looking at it again it doesn't seem important to me. There's a lot to be said for specifying the semantics of operations as obvious, simple definitions like
If you have a mixed-type array, the behavior is not surprising since it just corresponds to this obvious definition. |
@JeffBezanson Right! Now that I think about it I think the reason for the complexity of the original code was to reuse the optimizations already in place and avoid some other performance pitfalls, (mostly slow anonymous functions) and the resulting semantics could've been seen as a plus since they encouraged better use of the short-circuiting behavior (e.g. the deprecation caught several uses of tl;dr I agree :P |
Since this change would be breaking, should we target it for 0.6? |
This was touched upon in #14782 (related: #11774), but there's no open issue for it. Currently,
The text was updated successfully, but these errors were encountered: