It seems to me there are two options when you have overlapping protocol 
requirements:

1. Declare one extension that satisfies the group of overlapping protocols. In 
this case, perhaps A, B, and C.

2. Break up the extensions per protocol. In this case you have the problem that 
you have to pick which protocol an overlapping method implementation gets 
grouped with. Alternately, put those methods in a shared extension.

Either way this is far from a perfect solution. But I wonder if practically, it 
might cover most cases. 

I am not sure there is a way to guarantee full coverage without annotating 
every protocol method. But given that we don't have optional requirements in 
protocols, The compiler will tell us if we remove a method we need. So we do 
not have a huge gap to cover, it seems to me.

> On Mar 19, 2016, at 12:07 PM, Daniel Duan <[email protected]> wrote:
> 
> (cc swift-evolution)
> 
> 
>> On Mar 19, 2016, at 8:41 AM, Step C <[email protected]> wrote:
>> 
>> The compiler can tell us when we have broken or not completed conformance, 
>> agreed. 
>> 
>> If we can empower extensions a bit more, we could also fully group each 
>> protocol conformance by extension.
> 
> How would you “group” conformances for the following 3 protocols?
> 
> protocol A {
>  func foo()
>  func bar()
> }
> protocol B {
>  func bar()
>  func baz()
> }
> protocol C: Equatable {
>  func bar()
> }
> 
> 
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to