From Kavon F(Apple), during Ask Apple
So, this interaction with default protocol witnesses has been reported before here. If you want the ability to override the Parent class's default witness to the f() requirement that was provided by Prot, the Parent , who is the actual conformer of the protocol, currently must provide its own witness so that the subclass (e.g., Example3 ) can use a standard method override to change the Parent behavior after the fact. Protocols don't support inheritance, so they're choosing the methods directly listed in the type that wants to conform (or using defaults). Since a subclass can always be substitued in places where the superclass type is expected, the subclass is considered to be already conforming to the protocol. Thus, the conformance listed in the subclass is currently considered meaningless. It could mean that, and to make it happen, a pitch on Swift Evolution would be a way to start the conversation.
Topic:
Programming Languages
SubTopic:
Swift
Tags: