[swift-evolution] Mark protocol methods with their protocol
Dave Abrahams
dabrahams at apple.com
Tue Sep 20 18:34:14 CDT 2016
on Tue Sep 20 2016, Karl <razielim-AT-gmail.com> wrote:
> I think the best way is to prefix the member name with the protocol, e.g:
>
> protocol MyProto {
> var aVariable : Int
> func aFunction()
> }
> class MyClass : MyProto {
> var MyProto.aVariable : Int
> func MyProto.aFunction() { … }
> }
...
> CC-ing Dave A, to understand better if this fits with the vision of protocols
I generally agree with Doug. The canonical way to indicate “this
method/property/type implements a requirement of protocol P” should be
to define the entity in an extension that also adds conformance to P.
If that's inadequate indication in some way we should find a way to
enhance it. I wouldn't mind the notation above, but only as a fallback,
not a reuquirement.
--
-Dave
More information about the swift-evolution
mailing list