No, I don’t. But those things mean different things.
In one you can do:
julia> struct Foo{T,S <: Vector{<:T}}
x :: S
end
julia> Foo{Real,Vector{Float64}}(zeros(2))
Foo{Real,Array{Float64,1}}([0.0, 0.0])
In the other you can’t:
julia> struct Foo2{T,S<:Vector{T}}
x :: S
end
julia> Foo2{Real,Vector{Float64}}(zeros(2))
ERROR: TypeError: in Foo2, in S, expected S<:Array{T,1}, got Type{Array{Float64,1}}
Interestingly, in the first case, with <:
, you cannot build the struct with mixed-type arrays, and we get the same error as you:
julia> Foo(Union{Float64,Int64}[1,1.0])
ERROR: UndefVarError: T not defined
(Maybe this gives a hint on what is going on)
In the second case, without the <:
, you can:
julia> Foo2(Union{Float64,Int64}[1,1.0])
Foo2{Union{Float64, Int64},Array{Union{Float64, Int64},1}}(Union{Float64, Int64}[1, 1.0])