Adding Either type to the Standard Library

When I refer to a OneOf type, I mean I mean a Variadic option type:

typealias MyType = OneOf<A, B, C>

to use MyType:

let myType = MyType(choosing: A())

To answer your question, I guess OneOf could allow that by requiring an index in its initialisation, but there are substantial drawbacks to doing that:

  1. A Tuple - (Foo, Foo) or just Foo - would be the correct way to do that.
  2. Features like "myType as? A", "MyType(choosing: A())" would not be able to be added in the future without source-breaking changes.
  3. It would be slower to do so - with run-time checks, and without compiler-errors it could be frustrating to get run-time ones.