[swift-evolution] [Draft Proposal] Improve protocol inheritance behaviour

Nevin Brackett-Rozinsky nevin.brackettrozinsky at gmail.com
Mon Mar 13 13:24:05 CDT 2017


I agree there is a problem here, and the mental model I want is for the
language to act “as if” the default implementation of the protocol
requirement “had actually been” implemented by each type which uses it.

In particular, if a class uses a default implementation for one of its
protocol requirements, I want its subclasses to use the “override” keyword
when implementing that method. After all the parent class *does* have a
version of that method which can be called, it just happens to have
received that version by default.

So, for the example in your proposal, I would prefer that the subclass
write “override func doTheSecondThing()”.

Nevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170313/784f0a7a/attachment.html>


More information about the swift-evolution mailing list