[swift-evolution] [Review] SE-0156: Class and Subtype existentials
Joe Groff
jgroff at apple.com
Wed Mar 1 11:35:43 CST 2017
> On Feb 28, 2017, at 10:39 PM, David Hart <david at hartbit.com> wrote:
>
>>
>> On 28 Feb 2017, at 22:53, Jordan Rose via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> Nitpick: 'C<T> & P' is just 'C<T>' in this example. You'd need a refinement of 'P' to make it interesting ('C<T> & Q’).
>
> Could generic specialisation be disallowed in constraints? I need to think about this.
I don't think there's any added complexity alone in allowing generic base class constraints in existentials, since we already support `<T: C<U>>` as a constraint on a generic parameter. It's the interaction between classes and protocols with associated types that's interesting. You don't even need a generic class:
protocol P { associatedtype T; func foo(_: T) }
class C: P { func foo(_: Int) {} }
protocol Q: P {}
let x: C & Q
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170301/68a32dd7/attachment.html>
More information about the swift-evolution
mailing list