>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 =
> 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
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.
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/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
> 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
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
> 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
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
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
> 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
> 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
> 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
> 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
14 matches
Mail list logo