[swift-evolution] Calling a Specific Implementation

John McCall rjmccall at apple.com
Thu Aug 18 10:32:46 CDT 2016


> On Aug 17, 2016, at 7:24 PM, Ben Rimmington <me at benrimmington.com> wrote:
>> On 18 Aug 2016, at 02:57, John McCall wrote:
>> 
>> Being able to bypass another class's overrides and jump to a specific superclass implementation on an arbitrary method call is badly encapsulation-breaking, and I can't think of any OO language with first-class support for it besides C++.  In every other language I know of, super dispatch is always restricted to the self object and only bypasses the overrides of the current class and its subclasses. Of course there are runtime tricks you can play to get this in, say, ObjC, but I'm not aware of them being frequently used.  I would really to see concrete evidence of this being useful and necessary before considering it any further.
> 
> Doesn't this already exist as "unapplied method references" in Swift?

Unapplied method references still dispatch down.  It's a pretty simple experiment to run for yourself.

John.

> 
> <https://github.com/apple/swift-evolution/blob/master/proposals/0042-flatten-method-types.md>
> 
> SE-0042 isn't implemented yet, so maybe the curried version should be deprecated?
> 
> -- Ben
> 



More information about the swift-evolution mailing list