[swift-evolution] Proposal: An Either Type in the STL

Joe Groff jgroff at apple.com
Thu Dec 10 12:38:01 CST 2015


> On Dec 10, 2015, at 10:34 AM, Matthew Johnson <matthew at anandabits.com> wrote:
> 
>> As an alternative to a semantically-neutral Either type, it might be worth considering the possibility of anonymous structural sum types (similar to how tuples are the structural analog of structs).
> 
> John mentioned that these are a massive complication for type systems when I proposed them as a possible way to implement throwing multiple error types.  Do you agree with that?

There are definitely problems if you expect them to behave like unions (so that the type `T + T` == `T`) or be unordered (so that `T + U` == `U + T`), which would be intuitively expected.

-Joe



More information about the swift-evolution mailing list