[swift-evolution] union types

Joe Groff jgroff at apple.com
Fri Dec 11 21:53:53 CST 2015


> On Dec 11, 2015, at 7:48 PM, Drew Crawford <drew at sealedabstract.com> wrote:
> 
> 
>> On Dec 11, 2015, at 9:01 PM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
>> 
>> with its Product type generalized to Any. 
> 
> 
> In the alternate example
> 
> protocol Factory {
>     typealias Product: ProductProtocol
>     func make() -> Product
>     var description : String { get }
> }
> 
> would it generalize to ProductProtocol (e.g. not Any)?

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.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151211/11a4adaa/attachment.html>


More information about the swift-evolution mailing list