[swift-evolution] union types
matthew at anandabits.com
Sat Dec 12 11:27:40 CST 2015
> Yeah, when generalizing a protocol type, we ought to be able to either generalize the associated types to their upper bounds, for use cases like yours, or constrain them to specific types, for the AnyGenerator<T> kind of case.
I'm really glad to see that this is planned as part of the Swift 3 generics work.
Will you also be able to support constraints relating more than one associated type? Something like protocol<P where P.Associated == P.Other.Associated>? And a further generalization to protocol<P, Q where P.Associated == Q.Associated>?
Will you also support protocol types that are partially bound allowing use of members that do not reference the unbound associated types?
More information about the swift-evolution