Adding Either type to the Standard Library

I'm not sure, and it's easy to confuse union and sum types…

The union type from, for example, C++ does not seem like a good fit for Swift to me, but a "tagged union with hidden tag" (see Ceylon for an example) is extremely powerful: The use case for sealed protocols could not only be modelled with tagged unions — imho it's actually the better way to do so.

Enums are quite different, and I have no idea how exactly anonymous enums should work.

2 Likes