<div dir="ltr">On 25 November 2017 at 23:39, Xiaodi Wu <span dir="ltr">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="">On Sat, Nov 25, 2017 at 5:21 PM, Mike Kluev <span dir="ltr">&lt;<a href="mailto:mike.kluev@gmail.com" target="_blank">mike.kluev@gmail.com</a>&gt;</span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span>On 25 November 2017 at 23:07, Xiaodi Wu <span dir="ltr">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;</span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div><div>Not sure what you’re asking. Equatable is a protocol.</div></div></span></blockquote><div><br></div></span><div>that&#39;s the point. i mean, if user writes this:</div><div><br></div><div>extension (Equatable, Equatable) : Equatable</div><div><br></div><div>what *else* could he mean other than this:</div><div><br></div><div>extension &lt;T: Equatable, R: Equatable&gt; (T, R) : Equatable</div></div></div></div></blockquote><div><br></div></span><div>No, it would mean extending the concrete type `(Equatable, Equatable)` (which has other roadblocks to becoming possible because Equatable has Self requirements).</div></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>and if it is indeed the only reasonable meaning we can think of - i&#39;d say the first notation is nicer.</div><span><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="gmail_quote"><div dir="auto">For a protocol P, (P, P) is a concrete type with two elements each of existential type P. </div></div></div></blockquote><div><br></div></span><div>this part i do not understand. protocol is not an existential type. or is it?</div></div></div></div></blockquote><div><br></div></span><div>Ah. You seem to be unfamiliar with protocol existentials. Protocols (currently, only those without Self or associated type requirements, for various implementation reasons) are themselves types. For example, you can write:</div><div><br></div><div>```</div><div>protocol P { }</div><div>extension Int : P { }</div><div>let x: P = 42</div><div>```</div></div></div></div></blockquote><div><br></div><div>thanks, indeed i was totally unaware of this. can&#39;t even find it in the language reference.</div><div><br></div><div>if i decipher this correctly, the above example with Equatable is probably &quot;fine&quot; (because Equatable has self requirement) but in other cases it won&#39;t be fine.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div>In this example, x is of type `P`, not of type `Int`. Let&#39;s clarify the difference:</div><div><br></div><div>```</div><div>extension Array where Element == P {</div><div>  func hi() {</div><div>    print(&quot;Hello&quot;)</div><div>  }</div><div>}</div><div><br></div><div>extension Array where Element : P {</div><div>  func hi() {</div><div>    print(&quot;World!&quot;)</div><div>  }</div><div>}</div><div><br></div><div>let y: [P] = [x]</div><div>let z: [Int] = [x as Int]</div><div><br></div><div>y.hi() // Prints &quot;Hello&quot;</div><div>z.hi() // Prints &quot;World!&quot;</div><div>```</div><div><br></div><div>Moreover, if we do not write the first `extension Array`, then `y.hi()` doesn&#39;t compile. This helps to illustrate that P does not conform to itself.</div><span class=""><div></div></span></div></div></div></blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">thanks for example. too subtle feature imho. i never thought protocol could be a type on it&#39;s own, makes the whole story more complex.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Mike</div><div class="gmail_extra"><br></div></div>