Re: [swift-evolution] Default implementation of protocols

2017-01-23 Thread Jonathan Hull via swift-evolution
Ok, I could get behind that. Especially if we get factory initializers on protocols… Thanks, Jon > On Jan 23, 2017, at 5:57 PM, Karl Wagner wrote: > > >> On 24 Jan 2017, at 01:13, Jonathan Hull via swift-evolution >> wrote: >> >> Have we considered allowing a struct/class/enum to have the

Re: [swift-evolution] Default implementation of protocols

2017-01-23 Thread Karl Wagner via swift-evolution
> On 24 Jan 2017, at 01:13, Jonathan Hull via swift-evolution > wrote: > > Have we considered allowing a struct/class/enum to have the same name as a > protocol as long as it conforms to the protocol? Type declarations would > have to always mean the protocol (which includes the concrete typ

Re: [swift-evolution] Default implementation of protocols

2017-01-23 Thread Xiaodi Wu via swift-evolution
Moreover, how would you extend the protocol? On Mon, Jan 23, 2017 at 19:51 Xiaodi Wu wrote: > No, I don't think so. How would you declare a variable of type X, meaning > the protocol? > On Mon, Jan 23, 2017 at 19:49 Jonathan Hull wrote: > > I agree with your point on classes, so maybe just value

Re: [swift-evolution] Default implementation of protocols

2017-01-23 Thread Xiaodi Wu via swift-evolution
No, I don't think so. How would you declare a variable of type X, meaning the protocol? On Mon, Jan 23, 2017 at 19:49 Jonathan Hull wrote: > I agree with your point on classes, so maybe just value types would be > allowed to do it (I have only wanted it for structs myself). I think I > answered

Re: [swift-evolution] Default implementation of protocols

2017-01-23 Thread Jonathan Hull via swift-evolution
I agree with your point on classes, so maybe just value types would be allowed to do it (I have only wanted it for structs myself). I think I answered your comment about distinguishing between existential and struct X if you re-read my original message. Thanks, Jon > On Jan 23, 2017, at 5:10

Re: [swift-evolution] Default implementation of protocols

2017-01-23 Thread Xiaodi Wu via swift-evolution
This would get very confusing, as it would be impossible for a class to distinguish conforming to protocol X vs. inheriting from base class X, or else we would have to change the spelling for that as well. Moreover, you would have no way of distinguishing the existential X from the struct X. I see

[swift-evolution] Default implementation of protocols

2017-01-23 Thread Jonathan Hull via swift-evolution
Have we considered allowing a struct/class/enum to have the same name as a protocol as long as it conforms to the protocol? Type declarations would have to always mean the protocol (which includes the concrete type as well). Static functions would always apply to the concrete type. Seems like