[swift-evolution] Making protocol conformance inheritance controllable

Evan Maloney emaloney at gilt.com
Thu Dec 10 23:33:01 CST 2015


On Thu, 10 Dec 2015 18:04:02 -0800, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:

> [...] I'd like to float the idea that protocol conformances *not be* inherited by default. If you declare a class as conforming to a protocol, only exactly that class can be bound to a type parameter constrained by that protocol [...]

You just blew my mind.

> This is undoubtedly a complication of the language, but I think it might let us more accurately model a lot of things people seem to want to do in practice with class hierarchies and protocols, and it simplifies the behavior of the arguably common case where inheritance of the conformance isn't desired. What do you all think?

Anything that raises the possibility of avoiding "required init(coder: NSCoder) { fatalError() }" all over my UIKit subclasses gets my support.

It's a bit radical, but the benefits as you've described them outweigh the costs, IMO.

All the best,
E.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151211/bf4b4d0c/attachment.html>


More information about the swift-evolution mailing list