<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">How about something along the lines of&nbsp;<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>protocol<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> Foo {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> doThing() -&gt; &lt;C:CollectionType, C.Generator.Element == Int&gt;C</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let</span> coll : &lt;MyColl&gt;MyColl = foo.doThing()</div></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><span style="color: rgb(61, 29, 129);" class="">print</span>(<span style="color: rgb(209, 47, 27);" class="">"got&nbsp;</span>\<span style="color: rgb(209, 47, 27);" class="">(</span>coll<span style="color: rgb(209, 47, 27);" class="">)!"</span>)</div></div><div class=""><br class=""></div><div class="">which compiles to be equivalent to&nbsp;</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>protocol<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> Foo {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> doThing(callback:<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">FooDoThingCallback</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>protocol</span> FooDoThingCallback {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> callback&lt;C : </span>CollectionType<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">where</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>C<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span>Generator<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span>Element<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> == </span>Int<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&gt;(coll:</span>C<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp; &nbsp; </span><span style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);" class="">foo</span><span style="font-family: Menlo; font-size: 11px;" class="">.doThing(MyCallback())</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; <span class="Apple-tab-span" style="white-space:pre">        </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span>&nbsp;MyCallback : <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">FooDoThingCallback</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> callback&lt;C : <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CollectionType</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">where</span> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">C</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Generator</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Element</span> == <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span>&gt;(coll:<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">C</span>) {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"got </span>\<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">(</span>coll<span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">)!"</span>)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>&nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div class=""><br class=""></div><div class="">-ken</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Dec 3, 2015, at 6:19 PM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Dec 3, 2015, at 6:10 PM, Tal Atlas &lt;<a href="mailto:me@tal.by" class="">me@tal.by</a>&gt; wrote:<br class=""><br class="">Thanks for the great info. I made this because I didn't see anything on the current plan and I really hope that whatever comes out has the power and ease of the proposal. <br class=""><br class="">Thanks again for the great responses. <br class=""></blockquote><br class="">No problem, thank you for writing this up! If you want to think about this more, some things you might consider:<br class=""><br class="">- What changes would be necessary to the standard library to make the most of this feature? Some particular problems we'd like to solve are to eliminate the need for the AnyGenerator/AnySequence/AnyCollection wrapper types, and to provide a solution for heterogeneous equality, so that protocols can inherit Equatable and Hashable without forfeiting the ability to be used dynamically. See Brent Simmons' Swift diary posts at <a href="http://inessential.com/swiftdiary" class="">http://inessential.com/swiftdiary</a> for an example of why the latter is important.<br class="">- A hybrid approach that allows for both generic parameters and associated types like Rust, as Kevin pointed out, or one where generic parameters are sugar for associated types, might be worth considering.<br class=""><br class="">Thanks again!<br class=""><br class="">-Joe<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></div></body></html>