<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">&lt;<a href="mailto:panajev@gmail.com" target="_blank">panajev@gmail.com</a>&gt;</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><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 &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; 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">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</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 &quot;class A : P&quot; is a class or a protocol?). This can be<br>
solved in code but I don&#39;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&#39;t know anything else about P, knowing whether P is a class or protocol is essentially useless even if you&#39;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>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt; I think that the current approach marks a regression in declarative<br>
&gt; expressiveness as the notion of extending a class over implementing a<br>
&gt; protocol is blurred while the concepts are IMHO not the same (the latter is<br>
&gt; about behaviour conformance not a is a relationship):<br>
&gt;<br>
&gt; Class/struct B : Class/struct A &lt;Protocol1 &amp; Protocol2&gt;<br>
&gt;<br>
&gt;<br>
&gt; would be a clear and concise way to express it that would not be confused<br>
&gt; even at a quick glance.<br>
&gt;<br>
&gt; Sent from my iPhone<br>
&gt;<br>
&gt; On 22 Jul 2016, at 14:47, Charlie Monroe via swift-evolution<br>
&gt; &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I agree that this is an issue. Mostly nowadays when more and more classes in<br>
&gt; Swift do not have a superclass - it simply looks weird:<br>
&gt;<br>
&gt; class MyClass: DataSource<br>
&gt;<br>
&gt; One doesn&#39;t know whether &quot;DataSource&quot; is a class, protocol, etc.<br>
&gt; Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC<br>
&gt; did it (which isn&#39;t possible with the generics now - is it?), but what about<br>
&gt; something like this?<br>
&gt;<br>
&gt; class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]<br>
&gt; class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]<br>
&gt; extension MyClass [OtherProtocol]<br>
&gt;<br>
&gt;<br>
&gt; On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution<br>
&gt; &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; I remember that this was discussed, but can&#39;t find any decision regarding<br>
&gt; this.. So, as a last chance, don&#39;t we want in Swift 3.0, as big source<br>
&gt; breaking change, separate class inheritance and protocol conformance in<br>
&gt; syntax?<br>
&gt;<br>
&gt;<br>
&gt; Sorry if there was a decision about this suggestions. Please let know in<br>
&gt; this case.<br>
&gt;<br>
&gt;<br>
&gt; I.e. when I see the following I can&#39;t understand if the class inherits from<br>
&gt; base class and conforms to protocols or just conforms to two protocols:<br>
&gt;<br>
&gt;<br>
&gt; class MyClass : First, Second, Third {<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt; We don&#39;t have a rule to name protocols with &#39;Protocol&#39;/other suffix/prefix,<br>
&gt; or classes with &#39;T&#39;/&#39;C&#39; prefix or something like this, so I believe to<br>
&gt; improve the clarity of code we should separate in syntax inheritance and<br>
&gt; conformance.<br>
&gt;<br>
&gt;<br>
&gt; As I understand we should discuss changes in these areas:<br>
&gt;<br>
&gt;<br>
&gt; 1. class inheritance :<br>
&gt;<br>
&gt; class Child: BaseClass<br>
&gt;<br>
&gt;<br>
&gt; 2. class conformance :<br>
&gt;<br>
&gt; class Child: SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 3. class inheritance + conformance :<br>
&gt;<br>
&gt; class Child: BaseClass, SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 4. protocol conformance for structs:<br>
&gt;<br>
&gt; struct Struct: SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 5. protocol inheritance:<br>
&gt;<br>
&gt; protocol Child: BaseProtocol1, BaseProtocol2<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; My suggestions:<br>
&gt;<br>
&gt;<br>
&gt; I) separate inheritance with double colon :<br>
&gt;<br>
&gt;<br>
&gt; 1. class inheritance :<br>
&gt;<br>
&gt; class Child:: BaseClass<br>
&gt;<br>
&gt;<br>
&gt; 2. class conformance :<br>
&gt;<br>
&gt; class Child: SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 3. class inheritance + conformance :<br>
&gt;<br>
&gt; class Child:: BaseClass : SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 4. protocol conformance for structs:<br>
&gt;<br>
&gt; struct Struct: SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 5. protocol inheritance:<br>
&gt;<br>
&gt; protocol Child:: BaseProtocol1, BaseProtocol2<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; II) in class definition use parenthesis to separate inheritance and<br>
&gt; conformance :<br>
&gt;<br>
&gt;<br>
&gt; 1. class inheritance :<br>
&gt;<br>
&gt; class Child: BaseClass<br>
&gt;<br>
&gt;<br>
&gt; 2. class conformance :<br>
&gt;<br>
&gt; class Child: (SomeProtocol1, SomeProtocol2)<br>
&gt;<br>
&gt;<br>
&gt; 3. class inheritance + conformance :<br>
&gt;<br>
&gt; class Child: BaseClass (SomeProtocol1, SomeProtocol2)<br>
&gt;<br>
&gt;<br>
&gt; 4. protocol conformance for structs:<br>
&gt;<br>
&gt; struct Struct: SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt; or<br>
&gt;<br>
&gt; struct Struct: (SomeProtocol1, SomeProtocol2)<br>
&gt;<br>
&gt; should be discussed<br>
&gt;<br>
&gt;<br>
&gt; 5. protocol inheritance:<br>
&gt;<br>
&gt; protocol Child: BaseProtocol1, BaseProtocol2<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; III) special word like &#39;conforms&#39;<br>
&gt;<br>
&gt;<br>
&gt; 1. class inheritance :<br>
&gt;<br>
&gt; class Child: BaseClass<br>
&gt;<br>
&gt;<br>
&gt; 2. class conformance :<br>
&gt;<br>
&gt; class Child: conforms SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt; or<br>
&gt;<br>
&gt; class Child conforms SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 3. class inheritance + conformance :<br>
&gt;<br>
&gt; class Child: BaseClass conforms SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 4. protocol conformance for structs:<br>
&gt;<br>
&gt; struct Struct: conforms SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt; or<br>
&gt;<br>
&gt; struct Struct conforms SomeProtocol1, SomeProtocol2<br>
&gt;<br>
&gt;<br>
&gt; 5. protocol inheritance:<br>
&gt;<br>
&gt; protocol Child: BaseProtocol1, BaseProtocol2<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Thoughts?<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt;<br>
&gt; swift-evolution mailing list<br>
&gt;<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt;<br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
&gt;<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>