> Begin forwarded message:
> 
> From: Victor Gao <[email protected]>
> Subject: Re: [swift-evolution] [swift evolution] [proposal] Proposal to add 
> "implement" keyword to denote protocol method implementation
> Date: March 18, 2016 at 21:48:53 ADT
> To: Ross O'Brien <[email protected]>
> 
> Hi Ross,
> 
> That’s a good point actually, your point about retroactive modeling.
> 
> Correct me if I’m wrong, but what you are saying is that if you have a class 
> that has some methods, and then you decided to create a protocol that has the 
> methods of the class. If you want the class to conform to the protocol, you 
> want to be able to do so without having to add the “implement” keyword in 
> front of every method implementation. Is that right?
> 
> I also understand that one of the problems with the “implement” keyword: when 
> you create an extension that adds a protocol conformance to a class,  if that 
> the class already has the methods defined in the protocol, it wouldn’t work 
> because the methods in the class don’t have the “implement” keyword! This is 
> a perplexing problem. 
> 
> Victor Gao
> 
> 
>> On Mar 18, 2016, at 21:11, Ross O'Brien <[email protected]> wrote:
>> 
>> I recently had the misfortune of deleting what turned out to be a necessary 
>> function, because it was an optional requirement of a protocol and wasn't 
>> being called by any code in the project, so I would sympathise with this.
>> 
>> On the other hand I've also written protocols composed entirely of functions 
>> that an established type already has, so I can retroactively have the type 
>> conform. (For example, there's no 'ArithmeticOperation' protocol which Int 
>> and Double both conform to, even though they both have a `+ (lhs:Self, 
>> rhs:Self) -> Self` operator, so you have to roll your own... unless that 
>> should be a proposal itself.) It would be impossible to require a function 
>> to use your 'implements' keyword to conform to a protocol in an importing 
>> module.
>> 
> 

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to