<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><div style="direction: inherit;">Sent from my iPhone</div></div><div><br>On 22 Jul 2016, at 19:10, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 22, 2016 at 1:04 PM, Goffredo Marocchi <span dir="ltr"><<a href="mailto:panajev@gmail.com" target="_blank">panajev@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div style="direction:inherit">This adds information without being a burden while the current approach mixes and matches in a workable but less consistent way.</div></div></div></blockquote><div><br></div><div>It adds no *useful* information.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div style="direction:inherit">Adopting a protocol is not the same as subclass for, why should it look the same syntax wise?</div></div></div></blockquote><div><br></div><div>As Daniel has pointed out, `class A : P { ... }` establishes a relationship such that `A is P`, regardless of whether P is a protocol or base class.</div></div></div></div></div></blockquote><div style="direction: inherit;"><br></div><div style="direction: inherit;">I do not think it is a fair statement IMHO. A can conform to P and/or be an A. I think the two concepts should stay separate as they are in many languages, but I can accept to be on the losing end of this.</div><div style="direction: inherit;"><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Sent from my iPhone</div><div><div class="h5"><div><br>On 22 Jul 2016, at 19:00, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 22, 2016 at 12:42 PM, Leonardo Pessoa via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It would still cause confusion if you were only to conform to a single<br>
protocol (P in "class A : P" is a class or a protocol?). This can be<br>
solved in code but I don't think it is necessary.<br></blockquote><div><br></div><div>The point made earlier is salient: if you know what P is, no clarification is necessary; on the other hand, if you don't know anything else about P, knowing whether P is a class or protocol is essentially useless even if you're a reader. What could you possibly do with this information?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
L<br>
<br>
<br>
On 22 July 2016 at 14:08, Goffredo Marocchi via swift-evolution<br>
<div><div><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
> I think that the current approach marks a regression in declarative<br>
> expressiveness as the notion of extending a class over implementing a<br>
> protocol is blurred while the concepts are IMHO not the same (the latter is<br>
> about behaviour conformance not a is a relationship):<br>
><br>
> Class/struct B : Class/struct A <Protocol1 & Protocol2><br>
><br>
><br>
> would be a clear and concise way to express it that would not be confused<br>
> even at a quick glance.<br>
><br>
> Sent from my iPhone<br>
><br>
> On 22 Jul 2016, at 14:47, Charlie Monroe via swift-evolution<br>
> <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
><br>
> I agree that this is an issue. Mostly nowadays when more and more classes in<br>
> Swift do not have a superclass - it simply looks weird:<br>
><br>
> class MyClass: DataSource<br>
><br>
> One doesn't know whether "DataSource" is a class, protocol, etc.<br>
> Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC<br>
> did it (which isn't possible with the generics now - is it?), but what about<br>
> something like this?<br>
><br>
> class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]<br>
> class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]<br>
> extension MyClass [OtherProtocol]<br>
><br>
><br>
> On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution<br>
> <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
><br>
><br>
> I remember that this was discussed, but can't find any decision regarding<br>
> this.. So, as a last chance, don't we want in Swift 3.0, as big source<br>
> breaking change, separate class inheritance and protocol conformance in<br>
> syntax?<br>
><br>
><br>
> Sorry if there was a decision about this suggestions. Please let know in<br>
> this case.<br>
><br>
><br>
> I.e. when I see the following I can't understand if the class inherits from<br>
> base class and conforms to protocols or just conforms to two protocols:<br>
><br>
><br>
> class MyClass : First, Second, Third {<br>
><br>
> }<br>
><br>
><br>
> We don't have a rule to name protocols with 'Protocol'/other suffix/prefix,<br>
> or classes with 'T'/'C' prefix or something like this, so I believe to<br>
> improve the clarity of code we should separate in syntax inheritance and<br>
> conformance.<br>
><br>
><br>
> As I understand we should discuss changes in these areas:<br>
><br>
><br>
> 1. class inheritance :<br>
><br>
> class Child: BaseClass<br>
><br>
><br>
> 2. class conformance :<br>
><br>
> class Child: SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 3. class inheritance + conformance :<br>
><br>
> class Child: BaseClass, SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 4. protocol conformance for structs:<br>
><br>
> struct Struct: SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 5. protocol inheritance:<br>
><br>
> protocol Child: BaseProtocol1, BaseProtocol2<br>
><br>
><br>
><br>
> My suggestions:<br>
><br>
><br>
> I) separate inheritance with double colon :<br>
><br>
><br>
> 1. class inheritance :<br>
><br>
> class Child:: BaseClass<br>
><br>
><br>
> 2. class conformance :<br>
><br>
> class Child: SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 3. class inheritance + conformance :<br>
><br>
> class Child:: BaseClass : SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 4. protocol conformance for structs:<br>
><br>
> struct Struct: SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 5. protocol inheritance:<br>
><br>
> protocol Child:: BaseProtocol1, BaseProtocol2<br>
><br>
><br>
><br>
> II) in class definition use parenthesis to separate inheritance and<br>
> conformance :<br>
><br>
><br>
> 1. class inheritance :<br>
><br>
> class Child: BaseClass<br>
><br>
><br>
> 2. class conformance :<br>
><br>
> class Child: (SomeProtocol1, SomeProtocol2)<br>
><br>
><br>
> 3. class inheritance + conformance :<br>
><br>
> class Child: BaseClass (SomeProtocol1, SomeProtocol2)<br>
><br>
><br>
> 4. protocol conformance for structs:<br>
><br>
> struct Struct: SomeProtocol1, SomeProtocol2<br>
><br>
> or<br>
><br>
> struct Struct: (SomeProtocol1, SomeProtocol2)<br>
><br>
> should be discussed<br>
><br>
><br>
> 5. protocol inheritance:<br>
><br>
> protocol Child: BaseProtocol1, BaseProtocol2<br>
><br>
><br>
><br>
> III) special word like 'conforms'<br>
><br>
><br>
> 1. class inheritance :<br>
><br>
> class Child: BaseClass<br>
><br>
><br>
> 2. class conformance :<br>
><br>
> class Child: conforms SomeProtocol1, SomeProtocol2<br>
><br>
> or<br>
><br>
> class Child conforms SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 3. class inheritance + conformance :<br>
><br>
> class Child: BaseClass conforms SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 4. protocol conformance for structs:<br>
><br>
> struct Struct: conforms SomeProtocol1, SomeProtocol2<br>
><br>
> or<br>
><br>
> struct Struct conforms SomeProtocol1, SomeProtocol2<br>
><br>
><br>
> 5. protocol inheritance:<br>
><br>
> protocol Child: BaseProtocol1, BaseProtocol2<br>
><br>
><br>
><br>
> Thoughts?<br>
><br>
> _______________________________________________<br>
><br>
> swift-evolution mailing list<br>
><br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
><br>
><br>
> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
><br>
><br>
> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
><br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div></div>
</div></blockquote></div></div></div></blockquote></div><br></div></div>
</div></blockquote></body></html>