Re: [swift-evolution] Calling a Specific Implementation

2016-08-19 Thread John McCall via swift-evolution
> On Aug 19, 2016, at 1:10 PM, John McCall wrote: >> On Aug 19, 2016, at 12:56 PM, Jonathan Hull > > wrote: >> >> For my own education, how is does it break the encapsulation in a way which >> subclassing does not? I may not have mentioned it, but in my mind, this >> con

Re: [swift-evolution] Calling a Specific Implementation

2016-08-19 Thread John McCall via swift-evolution
> On Aug 19, 2016, at 12:56 PM, Jonathan Hull wrote: > > For my own education, how is does it break the encapsulation in a way which > subclassing does not? I may not have mentioned it, but in my mind, this > construct would be limited by the compiler to being called from within a > conformi

Re: [swift-evolution] Calling a Specific Implementation

2016-08-19 Thread Charlie Monroe via swift-evolution
A agree with John. Imagine class A { func foo() -> Int { return bar() } func bar() -> Int { return 0 } } class B { override foo() -> Int { return bar() + 1 } overr func bar() -> Int { return 32 } } What would A(foo) return? Some

Re: [swift-evolution] Calling a Specific Implementation

2016-08-19 Thread Jonathan Hull via swift-evolution
For my own education, how is does it break the encapsulation in a way which subclassing does not? I may not have mentioned it, but in my mind, this construct would be limited by the compiler to being called from within a conforming type (in the same way super is). Given that, it seems to me th

Re: [swift-evolution] Calling a Specific Implementation

2016-08-19 Thread Félix Cloutier via swift-evolution
What if two modules declare the same extension method? Félix > Le 19 août 2016 à 03:06:23, Brent Royal-Gordon via swift-evolution > a écrit : > >> On Aug 17, 2016, at 6:57 PM, John McCall via swift-evolution >> wrote: >> >> Being able to bypass another class's overrides and jump to a specif

Re: [swift-evolution] Calling a Specific Implementation

2016-08-19 Thread Brent Royal-Gordon via swift-evolution
> On Aug 17, 2016, at 6:57 PM, John McCall via swift-evolution > 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 >

Re: [swift-evolution] Calling a Specific Implementation

2016-08-18 Thread Slava Pestov via swift-evolution
> On Aug 18, 2016, at 8:21 PM, Ben Rimmington via swift-evolution > wrote: > > >> On 18 Aug 2016, at 16:32, John McCall wrote: >> >> Unapplied method references still dispatch down. It's a pretty simple >> experiment to run for yourself. > > When I tried calling a specific superclass impl

Re: [swift-evolution] Calling a Specific Implementation

2016-08-18 Thread Ben Rimmington via swift-evolution
> On 18 Aug 2016, at 16:32, John McCall wrote: > > Unapplied method references still dispatch down. It's a pretty simple > experiment to run for yourself. When I tried calling a specific superclass implementation, there was a stack overflow due to the infinite recursion. class Once

Re: [swift-evolution] Calling a Specific Implementation

2016-08-18 Thread John McCall via swift-evolution
> On Aug 17, 2016, at 7:24 PM, Ben Rimmington 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

Re: [swift-evolution] Calling a Specific Implementation

2016-08-17 Thread Ben Rimmington via swift-evolution
> 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++

Re: [swift-evolution] Calling a Specific Implementation

2016-08-17 Thread John McCall via swift-evolution
> On Aug 17, 2016, at 5:46 PM, Jonathan Hull via swift-evolution > wrote: > > I believe this affects the ABI (especially the second part), but if not, let > me know and we can talk about it in phase 2... > > There are times where you would like to call a specific implementation of a > method.

[swift-evolution] Calling a Specific Implementation

2016-08-17 Thread Jonathan Hull via swift-evolution
I believe this affects the ABI (especially the second part), but if not, let me know and we can talk about it in phase 2... There are times where you would like to call a specific implementation of a method. One of the most common is calling super from a subclass, but you may want to do simila