we likely need to update the interfaces documention to say that types which wrap arrays and allow mutation should also overload Base.mightindex
Since the wrapper arrays in the stdlib get it right, but the ecosystem doesn’t all get it right. OffsetArrays.jl does, but NamedDims.jl doesn’t.
julia> x = [1,2,3];
julia> Base.mightalias(x, x)
true
julia> Base.mightalias(x, view(x, :))
true
julia> Base.mightalias(x, x')
true
julia> Base.mightalias(x, view(x', :))
true
julia> using OffsetArrays; Base.mightalias(x, OffsetArray(x))
true
julia> using NamedDims; Base.mightalias(x, NamedDimsArray{(:foo,)}(x);)
false
Still this seems a reasonable request to put on to package authors.
if mightalias is indeed the correct function to use for this.