Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Xiaodi Wu via swift-evolution
>Possible solution: if you want a new protocol adoption to map to some existing >method or property then you must explicitly write that. You can't just adopt >the protocol in an empty extension. > >extension Int: BoundedType { >static var min = Int.min >static var max =

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Xiaodi Wu via swift-evolution
> The pattern might exist for some existing classes or structs but it might > still be useful for new classes or even for some existing ones to provide a > default implementation. I agree. It could be very useful in certain circumstances, and I agree that any proposal that made this no longer

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Xiaodi Wu via swift-evolution
You're quite right: in the worst case, the number of protocols you would need would be linear to the number of methods. It's not the best, I will concede. It does seem to be rather the "Swifty" way, though. At least, if we follow the example of the Swift standard library, it's not discouraged.

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Thorsten Seitz via swift-evolution
___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Greg Parker via swift-evolution
> On Jan 5, 2016, at 8:50 PM, Brent Royal-Gordon via swift-evolution > wrote: > >> Taking inspiration from syntax used for methods in classes that override >> methods in superclasses, require methods that override dynamically >> dispatched default implementations

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Matthew Johnson via swift-evolution
> On Jan 6, 2016, at 3:48 AM, Greg Parker via swift-evolution > wrote: > >> >> On Jan 5, 2016, at 8:50 PM, Brent Royal-Gordon via swift-evolution >> wrote: >> >>> Taking inspiration from syntax used for methods in classes that override

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Howard Lovatt via swift-evolution
I like Greg Parkers suggestion, if the extension is of a type that is not part of the project/library that is being developed then you don't need override. This would allow after-the-fact extensions to library and third-party structure/classes. It is also not confusing to human or compiler, since

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Xiaodi Wu via swift-evolution
> I don't like this solution because the compiler produces poor error > messages. It says that the type that implements the protocol doesn't conform > to the protocol in all three cases described below. Whereas if override were > required the compiler would say one of: I completely agree that the

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Howard Lovatt via swift-evolution
Comments in-line below. On Thursday, 7 January 2016, Xiaodi Wu via swift-evolution < swift-evolution@swift.org> wrote: > > Another option might be to allow imported definitions to be used by a > > conformance without the `override` marking to support retroactive > modeling > > while requiring

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Howard Lovatt via swift-evolution
The point is that without the requirement of both final and override the compiler doesn't know in detail what the problem is; just that there is a problem, it doesn't have enough information (it doesn't know the programmers intention - override and final clarify that intension). That is

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-06 Thread Brent Royal-Gordon via swift-evolution
> Another option might be to allow imported definitions to be used by a > conformance without the `override` marking to support retroactive modeling > while requiring definitions in the same module as the conformance to > explicitly specify the `override`. But the same problem exists if you

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-05 Thread Xiaodi Wu via swift-evolution
> This has been suggested before, usually in the form of a separate `implement` keyword. The main problem is that it makes it impossible to write a protocol after the fact which formalizes some existing pattern in the types. I think this is a great point and would be a con that I hadn't

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-05 Thread Thorsten Seitz via swift-evolution
> Am 06.01.2016 um 06:23 schrieb Xiaodi Wu via swift-evolution > : > > It would remain very much possible to formalize an existing pattern because, > in the case of your example (unless I'm misunderstanding?), you are not also > providing a default implementation of

Re: [swift-evolution] Require use of override keyword to override dynamically dispatched methods defined in a protocol with a default implementation

2016-01-05 Thread Brent Royal-Gordon via swift-evolution
> Taking inspiration from syntax used for methods in classes that override > methods in superclasses, require methods that override dynamically dispatched > default implementations in protocol extensions to use the override keyword. > Likewise, forbid the override keyword if the method being