# How to interpret the methods for Union{}?

**URL:** <https://discourse.julialang.org/t/how-to-interpret-the-methods-for-union/80166>\
**Category:** General Usage\
**Tags:** type, function\
**Created:** [April 27, 2022, 7:14pm UTC](https://discourse.julialang.org/t/how-to-interpret-the-methods-for-union/80166 "2022-04-27T19:14:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [April 27, 2022, 7:14pm UTC](https://discourse.julialang.org/t/how-to-interpret-the-methods-for-union/80166/1 "2022-04-27T19:14:42Z")

</div>

I find

```julia
julia> methods(Union{})
# 4 methods for callable object:
[1] (::Type{T})(x::Number) where T<:AbstractChar in Base at char.jl:48
[2] (::Type{T})(x::Rational{S}) where {S, T<:AbstractFloat} in Base at rational.jl:114
[3] (::Type{T})(x::Real, r::RoundingMode) where T<:AbstractFloat in Base.Rounding at rounding.jl:207
[4] Union{}(a...) in Core at boot.jl:263

```

I realize that this is somewhat unusual, and may be meaningless, but what are the methods telling me here? In particular, why the top 3 methods, and no other?

```julia
julia> Union{} <: T where T
true

```

so, `T` can be anything really, can’t it?

---

<div class="post-metadata">

**Author:** ![suavesito](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/suavesito/32/34386_2.png) [@suavesito](https://discourse.julialang.org/u/suavesito)\
**Post date:** [April 27, 2022, 7:23pm UTC](https://discourse.julialang.org/t/how-to-interpret-the-methods-for-union/80166/2 "2022-04-27T19:23:44Z")

</div>

The first three says that you can do something like `Int(4.0)` which is equivalent to `(Int)(4.0)`. In this case, `Int` will be the `::Type{T}` for the third method and `4.0` will be `x::Real`.

As `Union{}` is the bottom type (more on this below), it means `where T <: AnotherType` will always be true, and that is why it is shown here.

The fourth method is just to throw an error if you try to instantiate an empty union `Union{}`. The code is [here](https://github.com/JuliaLang/julia/blob/master/base/boot.jl#L263).

Finally, yes. `Union{}` is the bottom type of Julia type hierarchy, which means that it is a _subtype_ of all types, including itself, just like `Any` is the top type, i.e., the _supertype_ of every all types, including itself. See

```julia
julia> Union{} <: Union{}
true

julia> Any <: Any
true

julia> T where T # this is just an alias for Any
Any

```
