[swift-evolution] two protocols with the same method name
Brent Royal-Gordon
brent at architechies.com
Wed Jan 13 17:37:02 CST 2016
> Brent ask a really good question: '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'.
> I believe it is strong enough.
Also, as I've thought about it more, I've realized that if we allow protocol extensions to add conformances, we can cleanly resolve the cases where two protocols *don't* conflict. For instance, if PrivatePhotos and PublicPhotos are supposed to be compatible:
protocol PhotosType {
func photos() -> String
}
extension PrivatePhotos: PhotosType {}
extension PublicPhotos: PhotosType {}
// Now that the relationship between PrivatePhotos and PublicPhotos has been retroactively modeled,
// we can conform one type to both protocols.
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list