# When is the signature of a method is a UnionAll?

**URL:** <https://discourse.julialang.org/t/when-is-the-signature-of-a-method-is-a-unionall/30000>\
**Category:** General Usage\
**Created:** [October 16, 2019, 9:02pm UTC](https://discourse.julialang.org/t/when-is-the-signature-of-a-method-is-a-unionall/30000 "2019-10-16T21:02:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [October 16, 2019, 9:02pm UTC](https://discourse.julialang.org/t/when-is-the-signature-of-a-method-is-a-unionall/30000/1 "2019-10-16T21:02:20Z")

</div>

let’s assume that I have a function f, and it has few methods.  
I want to see an example where one of those methods’ signature is UnionAll instead of Tuple?  
methods(f).ms[1].sig

Is there such an example?

And as my second question, you can see the type of field named “sig” is Type.  
So it can be Tuple, UnionAll or some other type? What are the commonly used types for method signature?

Thanks

---

<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:** [October 16, 2019, 9:13pm UTC](https://discourse.julialang.org/t/when-is-the-signature-of-a-method-is-a-unionall/30000/2 "2019-10-16T21:13:19Z")

</div>

```julia
julia> f(x::Vector{T}) where T = 0
f (generic function with 1 method)

julia> methods(f).ms[1].sig
Tuple{typeof(f),Array{T,1}} where T

julia> typeof(methods(f).ms[1].sig)
UnionAll

```

The signature is basically the tuple type (could be union(all) of it) that is describing the argument tuple. What do you want to do with them? (i.e. why are you interested in the “commonly used types” there, do you have something more specific in mind).

---

<div class="post-metadata">

**Author:** ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Post date:** [October 16, 2019, 9:22pm UTC](https://discourse.julialang.org/t/when-is-the-signature-of-a-method-is-a-unionall/30000/3 "2019-10-16T21:22:23Z")

</div>

Thank you, I have an idea about covariant and contravariant dispatch.
