[swift-evolution] protocol can only be used as a generic constraint because it has Self or associated type requirements

Thorsten Seitz tseitz42 at icloud.com
Wed Dec 16 16:49:37 CST 2015


> Am 16.12.2015 um 02:06 schrieb Dave Abrahams <dabrahams at apple.com>:
> 
> 
>> On Dec 15, 2015, at 10:02 AM, Thorsten Seitz <tseitz42 at icloud.com> wrote:
>> 
>> Shouldn’t we just narrow the type of protocols with associated types and/or Self types when the protocol is used as a type?
> 
> 
> Then you have the “P doesn’t conform to P” problem, which is too crazy to live.  A recent internal discussion led to the idea that we should have notation for the existentially-viable subset of a protocol, so you could always make Array<existential P> but not necessarily Array<P> for an arbitrary protocol P.  

Making this narrowing explicit is a good idea!

-Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/d10b7f7d/attachment.html>


More information about the swift-evolution mailing list