[swift-evolution] Mark protocol methods with their protocol

Martin Waitz tali at admingilde.org
Tue Sep 20 09:48:36 CDT 2016

Hello everybody,

Several suggestions are floating around about explicitly marking a 
method to implement a protocol requirement.


> class Foo : Bar {
> 	implement func foo() {...}
> }

However, with extensions we can already do something very similar:

   class Foo {
   extension Foo: Bar {
       func foo() {...}

Maybe simply adding a new warning would already help.
Extensions which introduce new protocol conformances could be reserved 
for those methods which are already defined within the protocol. 
Whenever such an extension contains an unrecognized method, we could 
issue a warning.
Or maybe even an error, but we should allow private methods as an 
exception (for helper functions which are clearly not related to the 

This way, when the programmer wants to make sure that her new method is 
used by a protocol then she can simply put that method in an extension.


More information about the swift-evolution mailing list