Abstract subtyping and type parameters

Could someone please explain why N is not defined for T2, or how to achieve what I intend to do with a different syntax, preferrably in v0.5? Thanks alot.

julia> abstract T1{N,T}

julia> abstract T2{_N<:N, _T<:T} <: T1{N,T}
ERROR: UndefVarError: N not defined

julia> abstract T3{N, T} <: T1{N,T}

abstract T2{N,T} <: T1{N,T}?

N isn’t defined because you never defined it. Upper bounds are completely ambiguous. If _N is Int, is N an Integer? Number ? Any ? You would need to say exactly what N is because of this ambiguity.

I see, so there is no way to “inherit” N from the supertype?

What supertype? The supertype can be T1{Int,T}, T1{Integer,T}, T1{Number,T}, T1{Any,T}. Write down some examples and you’ll see this makes absolutely no sense and it’s not decidable in the least bit.

1 Like

I will rethink what I am trying to do. Thanks.