Open
Description
Base.mightalias
's docstring says (my emphasis)
Perform a conservative test to check if arrays A and B might share the same memory.
Yet, its default implementation basically always returns false , even for objects that does alias:
julia> struct Foo <: AbstractVector{Int}
x::Vector{Int}
end;
julia> x = [1,2];
julia> Base.mightalias(x, Foo(x))
false
julia> d = Dict();
julia> Base.mightalias(d, d.keys)
false
I think this is a problem. Presumably, mightalias
is going to be used as a guard to prevent aliasing bugs. Having it claim to be conservative, but actually falsely return false
for most arguments is a huge footgun.
Luckily for this issue, Base.mightalias
does not appear to be documented in the official Julia docs, so it's fair game to change. I believe the best course of action is to remove the default fallback implementation(s) for this and Base.dataids
.
See also: #26865
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment