These all produce the same type: CircularArray{Float64, 2, Matrix{Float64}}
CircularArray( zeros(2, 2) )
CircularArray{Float64}( zeros(2, 2) )
CircularArray{Float64, 2}( zeros(2, 2) )
However, CircularArray{Float64, 2, Matrix{Float64}}( zeros(2, 2) ) fails with MethodError: no method matching CircularArray{Float64, 2, Matrix{Float64}}(::Matrix{Float64})
This is a problem when creating a function that takes an AbstractArray, produces a new Vector that gets reshaped to the same size as the AbstractArray, then tries to return the same type as the original AbstractArray using convert, or by trying to call the constructor using typeofor by the function being parametric.
I think the missing constructor can be addressed by adding a constructor that is parametric on all three types? I don't know if it makes sense to have convert work in this context.
These all produce the same type: CircularArray{Float64, 2, Matrix{Float64}}
CircularArray( zeros(2, 2) )
CircularArray{Float64}( zeros(2, 2) )
CircularArray{Float64, 2}( zeros(2, 2) )
However,
CircularArray{Float64, 2, Matrix{Float64}}( zeros(2, 2) )
fails withMethodError: no method matching CircularArray{Float64, 2, Matrix{Float64}}(::Matrix{Float64})
This is a problem when creating a function that takes an AbstractArray, produces a new Vector that gets
reshape
d to the samesize
as the AbstractArray, then tries to return the same type as the original AbstractArray usingconvert
, or by trying to call the constructor usingtypeof
or by the function being parametric.I think the missing constructor can be addressed by adding a constructor that is parametric on all three types? I don't know if it makes sense to have
convert
work in this context.