Any way to call `getindex(v, end)`?

end in indexing expressions just lowers to lastindex. That is, v[end] is lowered to getindex(v, lastindex(v)):

julia> Meta.@lower v[end]
:($(Expr(:thunk, CodeInfo(
1 ─ %1 = v
│   %2 = v
│   %3 = Base.lastindex(%2)
│   %4 = Base.getindex(%1, %3)
└──      return %4
))))
10 Likes