Proposed alias for union types

I couldn’t find anything either. And that is exactly why I made this thread! This isn’t a concrete proposal, I’m just interested in discussing the idea and testing the waters.

Regarding @StefanKarpinski’s thread, I want to emphasize that the idea discussed here is not to change any existing syntax: it’s to add a new method, which I would think (?) is compatible with Julia 1.x’s syntax freeze –

So, Union{...} would still be the type, this is just a new alternative for constructing them. (An analagous situation happened for Python 3.9 → 3.10 [here] when they introduced | as an alternative to their existing Union[] type hint, which happens to also be bitwise-or for bools and integers.) It’s not a breaking change, just a new method. Since | currently throws an error on ::Type input, this would not affect existing code.

4 Likes