> On Sep 20, 2016, at 4:34 PM, Dave Abrahams via swift-evolution > <swift-evolution@swift.org> wrote: > > > 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 > _______________________________________________
Indeed this is exactly how C# handles Interfaces (protocols). The default is the exact same way Swift works - by matching names. If there is a collision you specify Protocol.memberName. Its simple and in the years I was writing C# code it was flexible enough to cover most reasonable scenarios, without adding a bunch of boilerplate. Russ _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution