# Union Types - Good or Bad?

**URL:** <https://discourse.julialang.org/t/union-types-good-or-bad/46255>\
**Category:** Internals & Design\
**Created:** [September 8, 2020, 10:30am UTC](https://discourse.julialang.org/t/union-types-good-or-bad/46255 "2020-09-08T10:30:55Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [September 9, 2020, 11:06pm UTC](https://discourse.julialang.org/t/union-types-good-or-bad/46255/18 "2020-09-09T23:06:37Z")

</div>

> [@seertaak](#):
>
> Towards the end, someone asks the question: “How much better or worse would the world be without union?”

That someone was me.  
And this is great because I can explain what I was thinking when I asked that.  
It wasn’t a complaint about unions at all, but a specific question in the context of Jeff’s talk mentioning contradictions and issues in the type system.

The particular case that is easy to remove is along the lines of

```julia
foo(x::Union{A, B}) = ...

```

One can replace that with

```julia
for T in (:A, :B)
   @eval foo(X::$T) = ...
end

```

Infact it is common to do this change over to remove ambiguities.

Not everything can be made ok. No more `Vector{Union{Missing, Float64}}`.  
And it’s breaking so it wasn’t actually a suggestion.  
But I was curious as to if removing unions would fix the things that break or are contradictory in the type system that Jeff mentioned during the talk  
Since several seemed to involve unions.

---

_[View the full topic](https://discourse.julialang.org/t/union-types-good-or-bad/46255)._
