SubArray is not AbstractArray

I was trying to fit a SubArray into a field of AbstractArray type and was surprised by this. I thought most, if not all, array types should be AbstractArray’s… Any reason why not?

julia> SubArray isa AbstractArray
false

I think you want/need SubArray <: AbstractArray instead.

I think of x isa T as translating to typeof(x) <: T.

2 Likes