-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Improve handling of aliasing of AbstractSlices #49182
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
base: master
Are you sure you want to change the base?
Conversation
|
We typically never do alias check between value and container though. (That would be quite costy in many cases) julia> A = [1]; B = [A;]; Base.mightalias(A, B)
false
julia> A = [1]; B = Ref(A); Base.mightalias(A, B)
false |
|
Not to sound too dramatic / inflammatory, but I feel pretty certain that the behavior OP originally noted in the Discourse is confusing and bad, and if not addressed in some way will become another thing pointed at during claims of "Julia has correctness issues" The equivalent code in numpy works exactly as expected but Julia: That's the intuitive/obvious implementation to me and I could see this resulting in an extremely insidious bug. |
I agree, but in this case I would quality |
This is equivalent to Even if aliasing were avoided, |
|
We have the same issue with Also - are these changes considered breaking or not? (probably they are breaking, and should be marked for 2.0 release) |
|
Thank you for approving. I added "DO NOT MERGE YET" to the name (I cannot set labels in this repository) as I think we need a broader discussion if we want this change:
If it is decided that we go for the change the PR still needs NEWS.md entry + documentation improvement (I will work on if after the consensus if the change is desirable is reached). |
|
|
Should this be backported to 1.9? No question about breaking if |
Currently broadcasting does not detect that slices might alias with parent:
See https://discourse.julialang.org/t/unexpected-broadcasting-behavior-involving-eachrow/96781 for an example when this creates a problem.