CatViews.jl
CatViews.jl copied to clipboard
Parameter Ordering not consistent with AbstractArray
To use CatView in my application, I need the following to be true:
CatView{Float64, 2} <: AbstractArray{Float64,2}
It looks like the parameter order is backwards compared to AbstractArray.
Would that be possible to fix?
Note that the following is true:
CatView <: AbstractArray
I have not looked closely at the code to see if there is a good reason not to do this (other than it being a breaking change).
But as a workaround you can define a type alias with what ever order you want.
e.g.
julia> abstract type AbstractFoo{X, Y} end
julia> struct Foo{Y, X} <: AbstractFoo{X, Y} end
julia> supertype(Foo{1,2})
AbstractFoo{2,1}
julia> const Bar{A, B} = Foo{B,A}
Foo{B,A} where B where A
julia> Bar{1,2}
Foo{2,1}
julia> Bar{1,2} <: AbstractFoo{1,2}
true
That's a great workaround that will keep me going for now. Thanks!