[swift-evolution] Warning when "overriding" an extension method that's not in the protocol?

Brent Royal-Gordon brent at architechies.com
Thu Dec 10 17:13:51 CST 2015

> If you've made it all the way through, I want to propose that we add a warning in case you override a protocol extension method that's visible in your scope (and has exactly the same type). For example, implementing `share()` in String could trigger a warning. In my experience, it's confusing that it looks like you're overriding it, but you're not really. I strongly believe the current behavior is correct, yet, it can be quite confusing, especially coming from ObjC.

We’re actually discussing this for the last few days in the threads "Proposal: Require explicit modifier for statically dispatched extension methods” (newer) and "Proposal: Universal dynamic dispatch for method calls” (older). You might want to dig into the list archives and take a look at them. <https://lists.swift.org/pipermail/swift-evolution/>

Brent Royal-Gordon

More information about the swift-evolution mailing list