[swift-evolution] two protocols with the same method name

Brent Royal-Gordon brent at architechies.com
Sat Jan 9 14:05:41 CST 2016


> Because you cannot solve the problem by revising your own code. You definitely have to change the protocols. If you have no way to change the protocols, you will have to drop either of them. 
> 
> My point is that it is the protocols' programmer who should take care of it, not you. Or if you write the protocols, you should avoid this at the beginning.

Well, that's exactly the point. In a perfect world, where the compiler could read your mind and figure out that the two protocols are incompatible, you would want Swift to raise an error indicating that the two protocols can't be used together. But the compiler can't read your mind, so we have to decide if "two unrelated protocols declare the same requirement" is a strong enough signal on its own to conclude that something's wrong.


-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list