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

Dave Abrahams dabrahams at apple.com
Tue Dec 15 19:06:23 CST 2015


> 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.  Just one way to address this use-case, of course.

-Dave



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


More information about the swift-evolution mailing list