<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class="">On Jun 16, 2016, at 8:29 AM, Thorsten Seitz via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div style="font-family: HelveticaNeue; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""><div class="">Protocols are a mechanism for deriving types from each other whereas generics are a way to parameterize types. My point was that Swift's other way to parameterize types, namely by associated types, is very similar to generics with wildcards when looking a the existentials of such protocols.</div></div></div></div></blockquote><br class=""></div><div>This has been a point of confusion for me as well. I keep hearing that associated types are different from generic protocols, but this seems like a distinction without a difference.</div><div><br class=""></div><div>Suppose Swift allowed generic protocols. How would a hypothetical Collection&lt;Foo&gt; be different in practice from the proposed existential Any&lt;Collection where .Element == Foo&gt;?</div><div><br class=""></div><div>Yes, in the realm of type theory and compiler internals they might represented differently, sure. But in practice, in terms of what code can actually do? I know of only two differences:</div><div><br class=""></div><div>1. A type can only conform to any given protocol with one set of type parameters. (Nothing can be both Collection&lt;Foo&gt; and Collection&lt;Bar&gt;.)</div><div><br class=""></div><div>2. When a type conforms to Collection, it declares “associatedtype Foo” instead of “: Collection&lt;Foo&gt;”, and Foo can be inferred by the compiler in some circumstances. That’s handy, but it’s a syntactic difference.</div><div><br class=""></div><div>Is there a deeper difference I’m missing?</div><div><br class=""></div><div>Cheers, P</div><div><br class=""></div></body></html>