<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}
h1 {
        color: #000000;
        font-size: 28pt;
}
h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}
h3 {
        font-size: 18px;
}
h4 {
        font-size: 16px;
}
h5 {
        font-size: 14px;
}
h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}
hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
display: inherit;
}
p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}
a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}
#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}
button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}
code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}
code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}
pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}
pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}
#ws { background-color: #f8f8f8; }
.bloop_markdown table {
border-collapse: collapse;
font-family: Helvetica, arial, freesans, clean, sans-serif;
color: rgb(51, 51, 51);
font-size: 15px; line-height: 25px;
padding: 0; }
.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }
.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }
.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }
.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
.bloop_markdown blockquote{
border-left: 4px solid #dddddd;
padding: 0 15px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
code, pre, #ws, #message {
word-break: normal;
word-wrap: normal;
}
hr {
display: inherit;
}
.bloop_markdown :first-child {
-webkit-margin-before: 0;
}
code, pre, #ws, #message {
font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}
.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p>Check out the thread called: <a href="https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20161128/subject.html">
How to rewrite this snippet without <code>existentials</code>?</a></p>
<p>On some classes I want to write something like this:</p>
<pre><code class="swift">enum X {…}
enum Y {…}
class A : Connection<X>, Connection<Y> { … }
let a = A()
let router = Router<X>()
router.register(a)
</code></pre>
<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1480700027883870208" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 2. Dezember 2016 um 18:32:47, Daniel Leping (<a href="mailto:daniel@crossroadlabs.xyz">daniel@crossroadlabs.xyz</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>
<title></title>
<div style="white-space:pre-wrap">Could you, please, bring a code
example?</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, 2 Dec 2016 at 19:31 Adrian Zubarev
<<a href="mailto:adrian.zubarev@devandartist.com">adrian.zubarev@devandartist.com</a>>
wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="gmail_msg">
<div class="m_-4644302281767839272bloop_markdown gmail_msg">
<p class="gmail_msg">The problem I bumped into is, that I cannot
overload a function which uses an associated type, so I could pass
that instance to different type which needs the other overloaded
function. Only generic protocols could do this.</p>
<p class="gmail_msg">Something similar is described as the top of
the <strong class="gmail_msg">Generic protocols</strong> section in
the <a href="https://github.com/apple/swift/blob/master/docs/GenericsManifesto.md#generic-protocols" class="gmail_msg" target="_blank">generics manifesto</a>.</p>
<p class="gmail_msg"></p>
</div>
<div class="m_-4644302281767839272bloop_original_html gmail_msg">
</div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="m_-4644302281767839272bloop_original_html gmail_msg">
<div id="m_-4644302281767839272bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto" class="gmail_msg"><br class="gmail_msg"></div>
<br class="gmail_msg">
<div id="m_-4644302281767839272bloop_sign_1480699617867569920" class="m_-4644302281767839272bloop_sign gmail_msg">
<div style="font-family:helvetica,arial;font-size:13px" class="gmail_msg">-- <br class="gmail_msg">
Adrian Zubarev<br class="gmail_msg">
Sent with Airmail</div>
</div>
<br class="gmail_msg"></div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="m_-4644302281767839272bloop_original_html gmail_msg">
<p class="m_-4644302281767839272airmail_on gmail_msg">Am 2.
Dezember 2016 um 18:25:49, Daniel Leping (<a href="mailto:daniel@crossroadlabs.xyz" class="gmail_msg" target="_blank">daniel@crossroadlabs.xyz</a>) schrieb:</p>
<blockquote type="cite" class="m_-4644302281767839272clean_bq gmail_msg">
<div class="gmail_msg">
<div class="gmail_msg"></div>
<div class="gmail_msg">
<div style="white-space:pre-wrap" class="gmail_msg"><span class="gmail_msg">Aren't protocols generic already using
associatedtype?<br class="gmail_msg">
<br class="gmail_msg">
Also, what I really would like to have is generic associatedtype.
Basically to work the very same way as typealias.<br class="gmail_msg">
<br class="gmail_msg">
Another nice to have feature might be having a possibility to add
the same generic protocol several times with different type
associated. It might be a bad C++ habit, though. Still I really
miss it sometimes :)<br class="gmail_msg">
<br class="gmail_msg">
What else is missing for me is possibility to declare a var or
return type by generic protocol. Have to create a specific class
all the time which is a big pain.</span></div>
<span class="gmail_msg"><br class="gmail_msg"></span>
<div class="gmail_quote gmail_msg">
<div dir="ltr" class="gmail_msg"><span class="gmail_msg">On Fri, 2
Dec 2016 at 18:36 Adrian Zubarev via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="gmail_msg"></span></div>
<blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="gmail_msg">
<div id="m_-4644302281767839272m_6504450228615953105bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto" class="gmail_msg"><span class="gmail_msg">Hi there, I wanted to ask
if we need generic protocols in stage one or is it something for
stage two? I literally bumped into a corner where I need them to
write a nice and type safe API.</span></div>
<span class="gmail_msg"><br class="gmail_msg"></span>
<div id="m_-4644302281767839272m_6504450228615953105bloop_sign_1480696419231974144" class="m_-4644302281767839272m_6504450228615953105bloop_sign gmail_msg">
<div style="font-family:helvetica,arial;font-size:13px" class="gmail_msg"><span class="gmail_msg">-- <br class="gmail_msg">
Adrian Zubarev<br class="gmail_msg">
Sent with Airmail</span></div>
</div>
</div>
<span class="gmail_msg">_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</span></blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>