[swift-evolution] Proposal: Universal dynamic dispatch for method calls
Gwendal Roué
gwendal.roue at gmail.com
Wed Dec 9 02:01:23 CST 2015
> Le 9 déc. 2015 à 06:31, Paul Cantrell <cantrell at pobox.com> a écrit :
>
> Gwendal Roué wrote:
>> Whatever the direction this proposal is aiming at, please remember that it is desirable for some APIs to let adopting types "override" the default implementation provided by protocols.
>
>
> I would certainly hope nobody is proposing changing that! Once a method is virtually dispatched, it should be virtual all the way down to the implementing type.
Yes, and it’s why I’m concerned. When a protocol provides a default implementation, how will an adopting type invoke that default implementation in its own implementation?
With classes, it’s easy: you call super.
With protocols, it’s much less easy, if possible at all, as soon as all methods are dynamically dispatched.
Gwendal Roué
More information about the swift-evolution
mailing list