I was going to suggest:
type MyType{A<:AbstractArray, T<:Unsigned}
data::A{T}
end
which does not work. The error is:
*ERROR: TypeError: Type{...} expression: expected Type{T}, got TypeVar*
Does anyone know whether this should work in an ideal world, or does the
type definition simply not make sense?
On Friday, April 29, 2016 at 12:44:14 AM UTC+2, Ben Ward wrote:
>
> Hi, I'm tying to create a parametric type which can hold a variable which
> could be any kind of vector, and whatever the vector is, it can store one
> of the UInts. So it could have:
>
> UInt8[1,2,3]
> UInt64[1,2,3]
> UnitRange(1, 3)
> UnitRange(UInt16(1), UInt16(3))
> ... and so on.
>
> But I'm having trouble deciding what needs to go in the parametric part of
> it's definition: e.g.
>
> MyType{T <: (unsure of this bit)}
> val::T
> end
>
>
> I thought that AbstractVector{Unsigned} might be the way to go, but
> Vector{UInt8} does not inherit from AbstractVector{Unsigned}.
>
> Thanks,
> Ben.
>