I thought arr[end] just called endof(arr), but that seems to not be the 
case. For example:

type TestType
  data::AbstractArray
end
Base.length(t::TestType) = length(t.data)
Base.size(t::TestType) = (length(t.data))
Base.endof(t::TestType) = t.data[2,:,:]
Base.getindex(t::TestType,i::Int) = t.data[i,:,:]

t = TestType(rand(4,4,3))
t[1]; t[2]; t[3]; t[4] #These all work
t.data[end,:,:] == t.data[4,:,:] #This works
endof(t) #This works
t[end] #No method matchin getindex(::TestType,::Array{Float64,2})

So if endof(t) != t[end], how exactly can one define it? Why is it 
calling getindex(::TestType,::Array{Float64,2})?

Reply via email to