[swift-evolution] [pitch] Implementation composition

Tino Heth 2th at gmx.de
Fri Nov 25 10:47:26 CST 2016


> In what way is this “hiding” protocol conformance? In the examples, MyClass is declaring conformance to A and B via the Useful protocol composition. Perhaps I should have made it clearer which bits are new/proposed: Only the implements word is new here, the protocol composition syntax (A & B) already exists.
> 
My fault — but imho this "sub-protocol" situation isn't that common, and it would make the proposal simpler if it starts with just forwarding:
class MyClass : A {
    private let a = ImplementsA() implements A
...

In this case, there is (small) repetition (which imho isn't that bad — but Kotlin has a nicer syntax for it).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161125/f5f464b4/attachment.html>


More information about the swift-evolution mailing list