Drawbacks of Option<T>

Untagged unions are pretty cool and something I hope we can have as first-class language constructs in some language at some point, but there are some implementation issues that have to be dealt with such that I don’t think it could be shoehorned into a language like Rust (unless it were an extremely limited implementation, and honestly even that might end up making our lives more complicated). Things like resolving unions of generics in which either generic is itself a union with overlap to the other can make some decisions ambiguous. Also things like Option<Option<T>> are hard to resolve this way because an untagged union by itself has no way to differentiate between None and Some(None).

/r/rust Thread