The Swift 2.2 manual says:

NOTE

Strictly speaking, you can write a custom class that conforms to 
CounterDataSource without implementing either protocol requirement. They are 
both optional, after all. Although technically allowed, this wouldn’t make for 
a very good data source.

I think it’d be helpful to get a compiler warning when you declare that a class 
or struct complies to a protocol (that only has optional methods) but doesn’t 
actually implement any of the protocol.

E.G., this show show a warning:

import Cocoa

class kindaUseless: NSObject, NSTableViewDelegate {
}


While this behavior is mathematically consistent, it’s not rational and doesn’t 
really fit in with Swift.

Extraneous protocol conformance is messy and I can’t imagine a scenario in 
which it’s actually useful.

Thoughts?

-W


_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to