Have you looked at how this is handled in Kotlin?
Imho Jetbrains solution is quite elegant — especially as it also has a natural
answer to another problem ("flexible memberwise initialization"; the whole init
process is only a short chapter in the docs).
Of course, their approach is different, but I'd rather copy from the best than
accept mediocrity because of the not invented here syndrome.
[short explanation: In Kotlin, we would have
class Forwarder(forwardee: Forwardee): P by forwardee {
…
}
forwardee would be available as a member, and because it is introduced before
the protocol conformance, it can be used there without irritation.
Bonus: The designated initializer is defined at the same time.
]
As for the implementation:
Why not simply make this feature syntactic sugar and just auto-generate the
forwarding methods?_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution