<div dir="ltr"><div>Right. If associated type has the same value for both conformances, then everything should be fine. Fixed that example.</div><div><br></div><div>- Anton</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-13 0:15 GMT+03:00 Dan Appel <span dir="ltr">&lt;<a href="mailto:dan.appel00@gmail.com" target="_blank">dan.appel00@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="">&gt;if our protocol conforms to a protocol with associated type requirements, then we still can&#39;t conform to our protocol multiple times.<div><br></div></span><div>I don&#39;t think so:</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span>protocol</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(209,216,124)">A</span><span style="color:rgb(183,196,209)"> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span style="color:rgb(183,196,209)">    </span><span>associatedtype</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(220,167,124)">TypeA</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209);min-height:13px"><span></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span>protocol</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(121,216,219)">B</span><span style="color:rgb(183,196,209)">&lt;</span><span style="color:rgb(120,216,158)">TypeB</span><span style="color:rgb(183,196,209)">&gt;: </span><span style="color:rgb(124,175,194)">A</span><span style="color:rgb(183,196,209)"> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>    </span><span style="color:rgb(194,161,187)">func</span><span> convert(from: </span><span style="color:rgb(124,175,194)">TypeB</span><span>) -&gt; </span><span style="color:rgb(220,167,124)">TypeA</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209);min-height:13px"><span></span><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span>struct</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(120,216,160)">C</span><span style="color:rgb(183,196,209)">: </span><span style="color:rgb(124,175,194)">A</span><span style="color:rgb(183,196,209)"> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span style="color:rgb(183,196,209)">    </span><span>typealias</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(220,167,124)">TypeA</span><span style="color:rgb(183,196,209)"> = </span><span style="color:rgb(124,175,194)">String</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span>extension</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(178,200,157)">C</span><span style="color:rgb(183,196,209)">: </span><span style="color:rgb(124,175,194)">B</span><span style="color:rgb(183,196,209)">&lt;</span><span style="color:rgb(124,175,194)">Int</span><span style="color:rgb(183,196,209)">&gt; {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>    </span><span style="color:rgb(194,161,187)">func</span><span> convert(from int: </span><span style="color:rgb(124,175,194)">Int</span><span>) -&gt; </span><span style="color:rgb(124,175,194)">String</span><span> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>        </span><span style="color:rgb(194,161,187)">return</span><span> </span><span style="color:rgb(124,175,194)">String</span><span>(</span><span style="color:rgb(121,209,219)">int</span><span>)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>    }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>}</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(194,161,187)"><span>extension</span><span style="color:rgb(183,196,209)"> </span><span style="color:rgb(178,200,157)">C</span><span style="color:rgb(183,196,209)">: </span><span style="color:rgb(124,175,194)">B</span><span style="color:rgb(183,196,209)">&lt;</span><span style="color:rgb(124,175,194)">Double</span><span style="color:rgb(183,196,209)">&gt; {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>    </span><span style="color:rgb(194,161,187)">func</span><span> convert(from double: </span><span style="color:rgb(124,175,194)">Double</span><span>) -&gt; </span><span style="color:rgb(124,175,194)">String</span><span> {</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>        </span><span style="color:rgb(194,161,187)">return</span><span> </span><span style="color:rgb(124,175,194)">String</span><span>(</span><span style="color:rgb(220,129,173)">double</span><span>)</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>    }</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo;color:rgb(183,196,209)"><span>}</span></p><div><br></div></div><div>Seems to me like the above should work fine: the associated type is declared once, but the generic protocol is conformed to multiple times.</div></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Sun, Jun 12, 2016 at 1:22 PM Антон Жилин &lt;<a href="mailto:antonyzhilin@gmail.com" target="_blank">antonyzhilin@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Copy of link to the proposal:</div><div><a href="https://github.com/Anton3/swift-evolution/blob/generic-protocols/proposals/NNNN-generic-protocols.md" target="_blank">https://github.com/Anton3/swift-evolution/blob/generic-protocols/proposals/NNNN-generic-protocols.md</a></div><div><br></div><div>Inline:<br></div><div class="gmail_extra"><br><div class="gmail_quote"></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-06-12 21:51 GMT+03:00 Dan Appel <span dir="ltr">&lt;<a href="mailto:dan.appel00@gmail.com" target="_blank">dan.appel00@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Awesome that you guys started this! I&#39;ve been meaning to pitch it for a while. Couple notes:<br><br>- in the motivation, you&#39;re conforming to SequenceType while defining a From protocol (just a typo I think)<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Fixed</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">- the proposal should mention Brent&#39;s comments since it doesn&#39;t have a rebuttal to the &quot;unlikely&quot; status generic protocols were given in the generic manifesto. Brent does a great job of doing that<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Added a bold link</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">- is there a way for generic protocols to still have associated types? I think that could have some interesting use cases.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Generic protocols can contain associated types, but no type can conform to multiple instances of such protocols.</div><div><br></div><div>Actually, this limitation is more restricting than it seems, because if our protocol conforms to a protocol with associated type requirements, then we still can&#39;t conform to our protocol multiple times.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Dan Appel<div><div><br><div class="gmail_quote"></div></div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div><div class="gmail_quote"><div dir="ltr">On Sun, Jun 12, 2016 at 11:28 AM Антон Жилин &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div></div></div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes, everything that works on generic types should work for generic protocols. I&#39;ll add that.<div><div><br><div>What won&#39;t work is declaring that  MyComparable : Comparable  iff  T == Self. The same won&#39;t work for current non-generic protocols as well.</div><div>Although that feature is highly requested, it is discussed in a separate proposal.</div></div><div><br></div><div>- Anton</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-12 21:16 GMT+03:00 Xiaodi Wu <span dir="ltr">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Sun, Jun 12, 2016 at 8:01 AM, Антон Жилин <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-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I&#39;ve prepared a proper draft:<div><br><div><div><a href="https://github.com/Anton3/swift-evolution/blob/generic-protocols/proposals/NNNN-generic-protocols.md" target="_blank">https://github.com/Anton3/swift-evolution/blob/generic-protocols/proposals/NNNN-generic-protocols.md</a><br></div></div></div><div><br></div></div></blockquote><div><br></div></span><div>When you propose this:</div><div><h3 style="margin-top:1em;margin-bottom:16px;line-height:1.43;font-size:1.5em;color:rgb(51,51,51);font-family:&quot;Helvetica Neue&quot;,Helvetica,&quot;Segoe UI&quot;,Arial,freesans,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,&quot;Segoe UI Symbol&quot;">Syntax in protocol extensions</h3><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:&quot;Helvetica Neue&quot;,Helvetica,&quot;Segoe UI&quot;,Arial,freesans,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,&quot;Segoe UI Symbol&quot;;font-size:16px"><pre style="font-family:Consolas,&quot;Liberation Mono&quot;,Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;border-radius:3px;background-color:rgb(247,247,247)"><span style="color:rgb(167,29,93)">protocol</span> MyComparable<span style="color:rgb(167,29,93)">&lt;</span>T<span style="color:rgb(167,29,93)">&gt;</span> {
  <span style="color:rgb(167,29,93)">func</span> <span style="color:rgb(121,93,163)">&lt;</span> (<span style="color:rgb(167,29,93)">left</span>: <span style="color:rgb(167,29,93)">Self</span>, <span style="color:rgb(167,29,93)">right</span>: T)
}
<span style="color:rgb(167,29,93)">extension</span> MyComparable {
  <span style="color:rgb(167,29,93)">func</span> <span style="color:rgb(121,93,163)">&gt;</span> (<span style="color:rgb(167,29,93)">left</span>: T, <span style="color:rgb(167,29,93)">right</span>: <span style="color:rgb(167,29,93)">Self</span>) {
    <span style="color:rgb(167,29,93)">return</span> <span style="color:rgb(167,29,93)">right</span> <span style="color:rgb(167,29,93)">&lt;</span> <span style="color:rgb(167,29,93)">left</span>
  }
}</pre></div></div><div> </div><div>Would it be possible for me to write something like:</div><div><br></div><div>```</div><div>extension MyComparable&lt;T : SignedNumber&gt; { ... }</div><div>```</div></div></div></div>
</blockquote></div><br></div></blockquote></div></div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
_______________________________________________<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>
</blockquote></div></div></div></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div>Dan Appel<br></div></div></div></div>
</font></span></blockquote></div></div></div></blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div>Dan Appel<br></div></div></div></div>
</font></span></blockquote></div><br></div>