Hello everybody,

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


E.g.:

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 protocol).

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.

--
Martin
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to