I agree with that. I believe I have more often run into name collisions for protocols with differing semantics then matching semantics. Actually far more often then both I have purposely used somewhat contrived naming in protocols to avoid collisions, if that can be avoided by leveraging the implicit namespacing that exists in the protocol's name; it would be nice language feature IMHO.<br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 27, 2016 at 7:51 AM Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
on Tue Sep 27 2016, Thorsten Seitz <tseitz42-AT-icloud.com> wrote:<br>
<br>
> While this solves the problem of overlapping names with different<br>
> semantics, how would you express the case where the names actually<br>
> have the same semantics, so that you only want to have one<br>
> implementor?<br>
><br>
> protocol A {<br>
> func specficSemantics()<br>
> func sameSemantics()<br>
> }<br>
><br>
> protocol B {<br>
> func specficSemantics()<br>
> func sameSemantics()<br>
> }<br>
><br>
> struct C : A, B {<br>
> // these implementations have to be specific for A and B so Karl’s approach allows to differentiate them<br>
> func A.specficSemantics() { … }<br>
> func B.specficSemantics() { … }<br>
><br>
> // this implementation should be shared by A and B because both share the same semantic here<br>
> func sameSemantics() { … } // ??<br>
><br>
> // would I have to write it like that (manual delegation to the shared implementation)?<br>
> func sameSemantics() { … }<br>
> func A.sameSemantics() { sameSemantics() }<br>
> func B.sameSemantics() { sameSemantics() }<br>
> }<br>
><br>
> -Thorsten<br>
<br>
The cases where you find these kinds of exact collisions are so rare (never in my<br>
career) that it's fine if some manual work is needed.<br>
<br>
--<br>
-Dave<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>