<div dir="ltr">On Sat, Jun 24, 2017 at 12:09 PM, David Sweeris <span dir="ltr">&lt;<a href="mailto:davesweeris@mac.com" target="_blank">davesweeris@mac.com</a>&gt;</span> wrote:<br><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 dir="auto"><div>Would that even compile? I thought I&#39;d remembered getting an &quot;illegal redefinition of T&quot; or some such error, but maybe I&#39;m misremembering (plus, I haven&#39;t tried in a really long time).</div></div></blockquote><div><br></div><div>There is no redefinition; it&#39;s just simple shadowing.</div><div><br></div><div>```</div><div><div>protocol P {</div><div>  associatedtype T</div><div>  func foo() -&gt; T</div><div>}</div><div><br></div><div>struct S&lt;T&gt; : P {</div><div>  func foo() -&gt; Int {</div><div>    return 42</div><div>  }</div><div>  func bar(_ x: T) -&gt; T {</div><div>    return x</div><div>  }</div><div>}</div><div><br></div><div>S&lt;String&gt;().foo() // P.T is Int</div><div>S&lt;String&gt;().bar(&quot;42&quot;) // S.T is String</div></div><div>```</div><div><br></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"><div dir="auto"><div id="gmail-m_-8044135647644333123AppleMailSignature">- Dave Sweeris </div><div><div class="gmail-h5"><div id="gmail-m_-8044135647644333123AppleMailSignature"><br></div><div>On Jun 24, 2017, at 08:48, 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>For every Bar.T that is currently distinct from Foo.T, this would be source-breaking.<br><div class="gmail_quote"><div dir="ltr">On Sat, Jun 24, 2017 at 01:51 David Sweeris via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></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"><br>
&gt; On Jun 23, 2017, at 5:28 PM, David Moore via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I do indeed have quite a few real examples of this, such prompted me to bring this up. I think this could be done without any impact to existing code, but it would require some type of keyword. Take the following as a possible prototype.<br>
&gt;<br>
&gt; protocol Foo {<br>
&gt;     associatedtype T<br>
&gt; }<br>
&gt;<br>
&gt; struct Bar&lt;T&gt; : Foo {<br>
&gt;     keyword typealias T // Or really any other syntactical implementation.<br>
&gt; }<br>
&gt;<br>
&gt; With an opt-in method we could implement this without affecting existing code, thereby making this more viable. I will send some examples later.<br>
<br>
At one point there was talk of just having generic parameters automatically becoming typealiases:<br>
struct Bar&lt;T&gt; : Foo {<br>
    // `T` is automatically an implicit typealias for, well, `T`<br>
}<br>
<br>
Dunno if that’s still the plan (or to what degree it ever was), but it’d work for me. I don’t even think it’d break source compatibility (though it may make a lot of typealiases unneeded.<br>
<br>
- Dave Sweeris<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
</blockquote></div>
</div></blockquote></div></div></div></blockquote></div><br></div></div>