StridedArray should be an abstract class, not a union · Issue #2345 · JuliaLang/julia (original) (raw)
Currently, Julia defines
typealias StridedArray{T,N,A<:Array} Union(Array{T,N}, SubArray{T,N,A})
It seems like it would be better to define
abstract StridedArray{T,N} <: AbstractArray{T,N}
and have Array
and SubArray
both inherit from StridedArray
.
The reason is that I would like to define a new StridedArray
type (wrapping a NumPy ndarray
). There is no reason, as far as I can tell, that I can't provide all the functionality of a SubArray
and be used everywhere the latter is usable, but currently it does not seem possible to do this. Changing to abstract StridedArray
would fix this.