<div dir="ltr">@Adrian, my comments inline below. Hope this helps.<br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 3, 2016 at 6:22 PM, Adrian Zubarev <span dir="ltr">&lt;<a href="mailto:adrian.zubarev@devandartist.com" target="_blank">adrian.zubarev@devandartist.com</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"><div style="word-wrap:break-word"><div class="gmail-m_805315748064065134bloop_markdown"><p>There is one thing that I want to point out with pitched syntactic sugar. <code>GenericMyProtocolName&lt;U&gt;</code> will also let you reuse <code>T</code> within a generic type, where currently we cannot nest protocols into types. Even if we could, it’s not clear if nested declarations like <code>protocol MyTProtocolName : MyProtocolName where U == T</code> would be possible, so that <code>T</code> from the outer generic type is accessible. </p>

<p>Autogenerating the only possible generic protocols from protocols with associated types as a syntactic sugar to reduce spawning of types like <code>IntFoo</code> (as previously showed) seems reasonable to me. It does not break the current protocol system, but solves the first generic protocol feature from the generics manifesto.</p>

<p>There are still a few more questioned to answer:</p>

<ul>
<li>How dow we want the generated parameter list to look like?</li></ul></div></div></blockquote><div> The most obvious thing is to do something like Foo&lt;Alias1 = Int, Alias2 = String&gt;. Otherwise we&#39;ll have to add some sort of associatedtype sorting before; which doesn&#39;t sound good and just adds more complexity. Any other options?</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="gmail-m_805315748064065134bloop_markdown"><ul>
<li>Can we drop <code>Generic</code> prefix without collisions?</li></ul></div></div></blockquote><div>I&#39;m pretty sure we could just use existing protocols. All the namings can be compiler generated as a function from protocol and arguments.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="gmail-m_805315748064065134bloop_markdown"><ul>
<li>Does this syntactic sugar improves the stdlib or affect ABI?</li></ul></div></div></blockquote><div>Don&#39;t see any implications. Assuming current stdlib doesn&#39;t use the feature. It&#39;s rather an addition than change.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="gmail-m_805315748064065134bloop_markdown"><ul>
</ul>

<p>There are probably some more questions I cannot foresee by myself. Feel free to jump in the discussion. ;)</p>

<p>PS: Yes this syntactic sugar does create an alternative way of creating ‘kinda’ the same protocol twice, but it reuses the pattern more naturally.</p>

<pre><code class="gmail-m_805315748064065134swift">protocol Foo { associatetype Inner : SomeOtherProtocol }

// Assuming String and Int conforms to SomeOtherProtocol
protocol StringFoo : Foo where Inner == String {}  
protocol IntFoo : Foo where Inner == Int {}  

// VS.

// autogenerated  
procotol GenericFoo&lt;Inner : SomeOtherProtocol&gt; : Foo { … }

// usage
GenericFoo&lt;String&gt;
GenericFoo&lt;Int&gt;

// or
typealias StringFoo = GenericFoo&lt;String&gt;
typealias IntFoo = GenericFoo&lt;Int&gt;</code></pre></div></div></blockquote><div>// The usage I propose is just do</div><div>typealias StringFoo = Foo&lt;Inner = String&gt;</div><div><br></div><div>//also in an inheritance like this:</div><div>class FooClass : Foo&lt;Inner = String&gt;, Foo&lt;Inner = Int&gt; {</div><div>//My question here is, though: how do we access Inner from FooClass<br></div><div><br></div><div>//Like this?</div><div>typealias InnerInt = Foo&lt;Inner = String&gt;.Inner</div><div>}</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="gmail-m_805315748064065134bloop_markdown"><pre> </pre></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div class="gmail-m_805315748064065134bloop_markdown"><pre><code class="gmail-m_805315748064065134swift">
</code></pre>

<p></p></div><div class="gmail-m_805315748064065134bloop_original_html"><span class="gmail-"><div id="gmail-m_805315748064065134bloop_customfont" style="font-family:helvetica,arial;font-size:13px;color:rgb(0,0,0);margin:0px"><br></div> <br> <div id="gmail-m_805315748064065134bloop_sign_1480780772434896896" class="gmail-m_805315748064065134bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br></span><div><div class="gmail-h5"><p class="gmail-m_805315748064065134airmail_on">Am 3. Dezember 2016 um 16:43:43, Daniel Leping (<a href="mailto:daniel@crossroadlabs.xyz" target="_blank">daniel@crossroadlabs.xyz</a>) schrieb:</p> <blockquote type="cite" class="gmail-m_805315748064065134clean_bq"><span><div><div></div><div>





<div style="white-space:pre-wrap">In general I&#39;m very positive with
the idea of generic protocols. This discussion is more about
syntactic sugar, though I really like where it goes.<br>
<br>
Off topic:<br>
IMO, we should revisit approaches others already use for conflicts
resolution. I personally tend to get something similar to Scala
traits. Should fit POT smoothly and naturally.</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Sat, 3 Dec 2016 at 16:30 Adrian Zubarev
&lt;<a href="mailto:adrian.zubarev@devandartist.com" target="_blank">adrian.zubarev@devandartist.<wbr>com</a>&gt;
wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word" class="gmail-m_805315748064065134gmail_msg">
<div class="gmail-m_805315748064065134m_6921161786416199282bloop_markdown gmail-m_805315748064065134gmail_msg">
<p class="gmail-m_805315748064065134gmail_msg">If I’m not mistaken here, <code class="gmail-m_805315748064065134gmail_msg">extension Foo where T == Int</code> will have an error
of redeclaration <code class="gmail-m_805315748064065134gmail_msg">foo</code> anyways.</p>
<p class="gmail-m_805315748064065134gmail_msg"></p>
</div>
<div class="gmail-m_805315748064065134m_6921161786416199282bloop_original_html gmail-m_805315748064065134gmail_msg">
</div>
</div>
<div style="word-wrap:break-word" class="gmail-m_805315748064065134gmail_msg">
<div class="gmail-m_805315748064065134m_6921161786416199282bloop_original_html gmail-m_805315748064065134gmail_msg">
<div id="gmail-m_805315748064065134m_6921161786416199282bloop_customfont" style="font-family:helvetica,arial;font-size:13px;color:rgb(0,0,0);margin:0px" class="gmail-m_805315748064065134gmail_msg"><br class="gmail-m_805315748064065134gmail_msg"></div>
<div id="gmail-m_805315748064065134m_6921161786416199282bloop_sign_1480775153794472960" class="gmail-m_805315748064065134m_6921161786416199282bloop_sign gmail-m_805315748064065134gmail_msg">
<div style="font-family:helvetica,arial;font-size:13px" class="gmail-m_805315748064065134gmail_msg">-- <br class="gmail-m_805315748064065134gmail_msg">
Adrian Zubarev<br class="gmail-m_805315748064065134gmail_msg">
Sent with Airmail</div>
</div>
<br class="gmail-m_805315748064065134gmail_msg"></div>
</div>
<div style="word-wrap:break-word" class="gmail-m_805315748064065134gmail_msg">
<div class="gmail-m_805315748064065134m_6921161786416199282bloop_original_html gmail-m_805315748064065134gmail_msg">
<p class="gmail-m_805315748064065134m_6921161786416199282airmail_on gmail-m_805315748064065134gmail_msg">Am 3. Dezember
2016 um 15:22:56, Adrian Zubarev (<a href="mailto:adrian.zubarev@devandartist.com" class="gmail-m_805315748064065134gmail_msg" target="_blank">adrian.zubarev@devandartist.<wbr>com</a>) schrieb:</p>
<blockquote type="cite" class="gmail-m_805315748064065134m_6921161786416199282clean_bq gmail-m_805315748064065134gmail_msg">
<div class="gmail-m_805315748064065134gmail_msg">
<pre style="margin:15px 0px;font-family:menlo,consolas,&quot;liberation mono&quot;,courier,monospace;font-size:10pt;border-radius:3px;background-color:rgb(248,248,248);color:rgb(0,0,0);border:1px solid rgb(204,204,204);overflow:auto;padding:4px 8px;word-break:normal;word-wrap:normal;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px" class="gmail-m_805315748064065134gmail_msg"><span class="gmail-m_805315748064065134gmail_msg"><code class="gmail-m_805315748064065134m_6921161786416199282swift gmail-m_805315748064065134gmail_msg" style="font-family:menlo,consolas,&quot;liberation mono&quot;,courier,monospace;font-size:10pt;border-radius:3px;background-color:rgb(248,248,248);color:inherit;border:0px;margin:0px;padding:0px;word-break:normal;word-wrap:normal">extension Foo where T == Int {
     func foo() {
          self.bar(o: 42) // calls a function that accepts an Int
     }
}</code></span></pre></div>
</blockquote>
</div>
</div>
</blockquote>
</div>


</div></div></span></blockquote></div></div></div><div class="gmail-m_805315748064065134bloop_markdown"><p></p></div></div></blockquote></div><br></div></div>