# Union all Types

**URL:** <https://discourse.julialang.org/t/union-all-types/90087>\
**Category:** General Usage\
**Tags:** type, functions, type-hierarchy\
**Created:** [November 11, 2022, 1:47am UTC](https://discourse.julialang.org/t/union-all-types/90087 "2022-11-11T01:47:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lincoln\_Hannah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lincoln_hannah/32/19198_2.png) [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Post date:** [November 11, 2022, 1:47am UTC](https://discourse.julialang.org/t/union-all-types/90087/1 "2022-11-11T01:47:33Z")

</div>

```julia
Pair{Symbol,Number}

```

Would be a nice short-hand for

```julia
Pair{Symbol,T} where T<:Number

```

is there a reason it can’t be written like this?  
it would be nice to write

```julia

f(x::Pair{Symbol,Number}) = 1

```

instead of

```julia
f(x::Pair{Symbol,T}) where T<:Number = 1

```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [November 11, 2022, 2:40am UTC](https://discourse.julialang.org/t/union-all-types/90087/2 "2022-11-11T02:40:29Z")

</div>

One can’t be a shorthand for the other because they mean different things. It comes down to the same thing that’s explained here: [Types · The Julia Language](https://docs.julialang.org/en/v1/manual/types/#Parametric-Types) where `Point{Real}` is not the same as `Point{T} where {T <: Real}` because a `Point{Int}` is not a subtype of `Point{Real}`. LIkewise a `Pair{Symbol, Float64}` is _not_ a subtype of `Point{Symbol, Number}`; they’re actually distinct types.

---

<div class="post-metadata">

**Author:** ![Lincoln\_Hannah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lincoln_hannah/32/19198_2.png) [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Post date:** [November 11, 2022, 2:57am UTC](https://discourse.julialang.org/t/union-all-types/90087/3 "2022-11-11T02:57:35Z")

</div>

Thanks. That link gives a shorthand:

```julia
f(x::Pair{Symbol,<:Number}) = 1

```
