# Abstract subtyping and type parameters

**URL:** <https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198>\
**Category:** New to Julia\
**Created:** [June 10, 2017, 1:35pm UTC](https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198 "2017-06-10T13:35:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [June 10, 2017, 1:35pm UTC](https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198/1 "2017-06-10T13:35:21Z")

</div>

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
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}

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 10, 2017, 1:45pm UTC](https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198/2 "2017-06-10T13:45:54Z")

</div>

> [@mohamed82008](#):
>
> 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?

`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.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [June 10, 2017, 1:46pm UTC](https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198/3 "2017-06-10T13:46:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [June 10, 2017, 1:48pm UTC](https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198/4 "2017-06-10T13:48:17Z")

</div>

> [@mohamed82008](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [June 10, 2017, 1:50pm UTC](https://discourse.julialang.org/t/abstract-subtyping-and-type-parameters/4198/5 "2017-06-10T13:50:21Z")

</div>

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