# Proposed alias for union types

**URL:** https://discourse.julialang.org/t/proposed-alias-for-union-types/108205
**Category:** Internals & Design
**Tags:** question, proposal
**Created:** [December 31, 2023, 1:43pm UTC](https://discourse.julialang.org/t/proposed-alias-for-union-types/108205 "2023-12-31T13:43:56Z")
**Posts on this page:** 1
**Showing post:** 61

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [January 2, 2024, 5:11pm UTC](https://discourse.julialang.org/t/proposed-alias-for-union-types/108205/61 "2024-01-02T17:11:24Z")

</div>

> [@MilesCranmer](#):
>
> `|` is being adopted as both logical-or and type union in TypeScript, PHP, Python, and Scala (both `3 | 5 == 7` and `String | Int == Union{String,Int}` are true in all four of them)

I do think the demands of generic programming + multiple dispatch + duck-typing make consistent naming relatively more important in Julia than in other languages. Naming is hard, though, and it can indeed be blurry, but in this case, `|` is firmly documented as a bitwise or, and I maintain that is a very different meaning from a type union.

There have been some very long threads here about what “meaning” itself means — here’s one decent entry-point: [Function name conflict: ADL / function merging? - #136 by StefanKarpinski](https://discourse.julialang.org/t/function-name-conflict-adl-function-merging/10335/136) and the subsequent few posts.

So then these considerations get weighted alongside the aesthetic nicety of `T | S` over `Union{T, S}`. Is that really worth it? 🤷

The place where this has been discussed before is in reference to `Missing` and `Nothing` — that’s where folks have more commonly run into unions and where (I agree) a shorthand would be nice. Check out:

> <https://github.com/JuliaLang/julia/issues/36628#issuecomment-657902429>
>
> As discussed in https://discourse.julialang.org/t/status-of-question-mark-syntax…-for-missing-values/27189 it would be really nice to have this syntax at some future release where one could type \`T?\` to indicate \`Union{T,Missing}\`. Possibly, also write \`mean?(xs)\` to automatically handle inputs with missing values.

---

_[View the full topic](https://discourse.julialang.org/t/proposed-alias-for-union-types/108205)._
