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

Trent Nadeau tanadeau at gmail.com
Sat Jan 9 16:11:34 CST 2016


Wallacy's solution above is similar to how Rust handles a very similar
situation. Rust errors out where there are conflicting implementations of
trait requirements in the same "scope". See
https://play.rust-lang.org/?gist=b7def3a2cd375ee80525&version=stable for an
example.


On Sat, Jan 9, 2016 at 3:05 PM, Brent Royal-Gordon via swift-evolution <
swift-evolution at swift.org> wrote:

> > 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
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>



-- 
Trent Nadeau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160109/8824311e/attachment.html>


More information about the swift-evolution mailing list