# Dispach on parametric types

**URL:** <https://discourse.julialang.org/t/dispach-on-parametric-types/33807>\
**Category:** New to Julia\
**Tags:** question, parametric-types, dispatch\
**Created:** [January 26, 2020, 1:32pm UTC](https://discourse.julialang.org/t/dispach-on-parametric-types/33807 "2020-01-26T13:32:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maikon\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maikon_araujo/32/11109_2.png) [@Maikon\_Araujo](https://discourse.julialang.org/u/Maikon_Araujo)\
**Post date:** [January 26, 2020, 1:32pm UTC](https://discourse.julialang.org/t/dispach-on-parametric-types/33807/1 "2020-01-26T13:32:13Z")

</div>

Is it possible to dispatch on parametric types? Something like that:

```julia
function f(x::F{Int}) where F end

```

Dispatch on types parameterized on ints.

Thank you.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 26, 2020, 1:49pm UTC](https://discourse.julialang.org/t/dispach-on-parametric-types/33807/2 "2020-01-26T13:49:13Z")

</div>

No and it most likely won’t be added since it is believed that this could make the dispatch complex enough to be undecidable.

Also, for this particular case (covariant) it is ambiguous what you want when you have `x::T` and `T <: T1{Int,Int} <: T2 <: T3{Int}`. Would you want `T1` or `T3`? or do you want not match?

---

<div class="post-metadata">

**Author:** ![Maikon\_Araujo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maikon_araujo/32/11109_2.png) [@Maikon\_Araujo](https://discourse.julialang.org/u/Maikon_Araujo)\
**Post date:** [January 26, 2020, 2:18pm UTC](https://discourse.julialang.org/t/dispach-on-parametric-types/33807/3 "2020-01-26T14:18:32Z")

</div>

Thank you for the fast reply. It is really a good point, for the example you gave I guess it should be T3, once it is the closest match for the type. Unless someone provides g(x:F{int, int}), where in that case would be T1.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 26, 2020, 4:18pm UTC](https://discourse.julialang.org/t/dispach-on-parametric-types/33807/4 "2020-01-26T16:18:38Z")

</div>

Well, `T <: T1{Int} <: T1 {Int, Int}`.

The point I’m making is basically that the way type parameters are applied isn’t a fundamental property of the type.
