You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe this needs an issue. With keyword indexing, end still seems to be replaced as if being used with positional indexing. This can lead to wrong answers or to errors:
julia> nda =NamedDimsArray{(:a, :b)}(reshape(1:12, 3,4))
3×4 NamedDimsArray{(:a, :b), Int64, 2, Base.ReshapedArray{Int64, 2, UnitRange{Int64}, Tuple{}}}:147102581136912
julia> nda[b=end, a=1]
7
julia> nda[b=3, a=1]
7
julia> nda[b=4, a=1]
10
julia> nda[b=1, a=end]
ERROR: BoundsError: attempt to access 3×4reshape(::UnitRange{Int64}, 3, 4) with eltype Int64 at index [4, 1]
Stacktrace:
julia> nda[a=end]
ERROR: BoundsError: attempt to access 3×4reshape(::UnitRange{Int64}, 3, 4) with eltype Int64 at index [12, 1:4]
I don't think there's anything this package can do about this. Apart from adding warnings in the manual.
But possibly Base ought not to allow this at all. Or ideally to lower it to Base.lastindex(x, :a) using the name of the keyword.
The text was updated successfully, but these errors were encountered:
Maybe this needs an issue. With keyword indexing,
end
still seems to be replaced as if being used with positional indexing. This can lead to wrong answers or to errors:I don't think there's anything this package can do about this. Apart from adding warnings in the manual.
But possibly Base ought not to allow this at all. Or ideally to lower it to
Base.lastindex(x, :a)
using the name of the keyword.The text was updated successfully, but these errors were encountered: