<div dir="ltr">In fact why not just use the generics syntax with protocols ? Anybody implementing a "Generic" Protocol has to specify the types.<div><br></div><div><div><div>protocol Collection<Key, Value ></div><div>{ </div><div><br></div><div> func get(key: Key) -> Value?</div><div>}</div><div><br></div><div>class StringCollection: Collection<Key: String, Value: String> </div><div>{</div><div><br></div><div>}</div></div></div><div><br></div><div><div>class GenericCollection<Type>: Collection<Key: Type, Value: Type> </div><div>{</div><div><br></div><div>}</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 23, 2015 at 11:18 AM, James Campbell <span dir="ltr"><<a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Maybe you could use the phrase "placeholder" type. If you think about it. typealias is a way of "aliasing" the type. i.e "Type B is just another name for Type C"<div><br></div><div>Associated type I always found a bit confusing, associated with what ? A placeholder type I feel explains it more plainly. Associated types are nothing but placeholders.</div><div><br></div><div>So this is my example:</div><div><br></div><div>protocol Collection</div><div>{ </div><div> typeplaceholder T</div><div> </div><div> func first() -> T?</div><div>}</div><div><br></div><div>class IntCollection: Collection</div><div>{</div><div> typeplaceholder T = Int</div><div>}</div><div><br></div><div>potentially you could provide some sort of syntax for setting it in the subclass part of the code.</div><div><br></div><div><div><br>protocol Collection</div><div>{ </div><div> typeplaceholder T</div><div> </div><div> func first() -> T?</div><div>}</div><div><br></div><div>class IntCollection: Collection<T:Int> //The T type placeholder is now an Int</div><div>{</div><div><br></div><div>}</div></div><div><br></div><div><div>class GenericCollection<F>: Collection<T:F> //The T type placeholder is now what ever the generic F is set to.</div><div>{</div><div><br></div><div>}</div></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Wed, Dec 23, 2015 at 11:00 AM, Tino Heth via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> "Associated type" is the name of this feature<br>
</span>The name of the concept is highly inexpressive, and I guess it's far easier to change the docs than to change the language…<br>
<div><div>_______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="">-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a></div></div></div></div></div></div>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div>+44 7523 279 698</div></div></div></div></div></div>
</div>