Re: Protocol extensions returning self

2016-02-05 Thread Jan E. Schotsman
On Feb 4, 2016, at 4:56 PM, Charles Jenkins wrote: Supposedly in a protocol, “Self” is the class implementing the protocol. So it seems to me that extension methods should be able to have a return type of Self so they can return self, and thus have the extension method behave the same as

Protocol extensions returning self

2016-02-04 Thread Charles Jenkins
I’m trying to learn how to use protocols and extensions to factor out redundant function bodies. Supposedly in a protocol, “Self” is the class implementing the protocol. So it seems to me that extension methods should be able to have a return type of Self so they can return self, and thus have

Re: Protocol extensions returning self

2016-02-04 Thread Jens Alfke
FYI, the swift-users list is a great place to ask questions about the Swift language (that don’t involve platform APIs.) Lots of expert users there, including Chris Lattner and other members of Apple’s Swift team. https://lists.swift.org/mailman/listinfo/swift-users

Re: Protocol extensions returning self

2016-02-04 Thread Quincey Morris
On Feb 4, 2016, at 05:03 , Charles Jenkins wrote: > > am I tilting at a windmill? The problem is that the protocol in unspecific as to what kind of types it can be applied to, and your intentions don’t work if the type is a struct**. In fact, you only apply it to classes