Can you post the code (or link to the repo) where you define your FArray type?

-s

> On Sep 21, 2015, at 12:38 AM, 'Greg Plowman' via julia-users 
> <[email protected]> wrote:
> 
> To further clarify, I thought I could specialise getindex / setindex! on 
> colon type argument.
> 
> see below, getindex2 is being called, but getindex is not being called.
> A[:] calls getindex(A::AbstractArray{T,N},I::AbstractArray{T,N}) at 
> abstractarray.jl:380
> presumably after [:] has been converted to [1:8]
> 
> 
> 
> julia> getindex(A::FArray, ::Colon) = A[start(A) : endof(A)]
> getindex (generic function with 177 methods)
> 
> julia> getindex2(A::FArray, ::Colon) = A[start(A) : endof(A)]
> getindex2 (generic function with 1 method)
> 
> julia> A = FZeros(Int, -2:8)
> 11-element FArray{Int64,1} (-2:8,)
> 
> julia> A[:]
> 8-element Array{Int64,1}:
>  0
>  0
>  0
>  0
>  0
>  0
>  0
>  0
> 
> julia> @which A[:]
> getindex(A::AbstractArray{T,N},I::AbstractArray{T,N}) at abstractarray.jl:380
> 
> julia> getindex2(A, :)
> 11-element Array{Int64,1}:
>  0
>  0
>  0
>  0
>  0
>  0
>  0
>  0
>  0
>  0
>  0
> 
> julia>
> 
> 

Reply via email to