<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 4, 2015, at 3:04 AM, Dapeng Gao &lt;<a href="mailto:gdapeng@icloud.com" class="">gdapeng@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">It would be handy if Swift can support generic `typealias`s, which would probably look like this:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c32275" class="">typealias</span> Handler&lt;Element&gt; = [Element] -&gt; Void</div></div></div></div></blockquote><div><br class=""></div><div>Yes, this is definitely something that I (at least) would like to see. &nbsp;Patches welcome :-)</div><div><br class=""></div><div>-Chris</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">One common way to achieve this is to define a generic `struct` and use a nested `typealias`:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c32275" class="">struct</span> HandlerWrapper&lt;Element&gt; {</div><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #c32275" class="">typealias</span> Hander = [<span style="font-variant-ligatures: no-common-ligatures; color: #6122ae" class="">Element</span>] -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Void</span></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class=""><div style="margin: 0px; color: rgb(83, 154, 164);" class="">HandlerWrapper<span style="" class="">&lt;</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">SomeType</span><span style="" class="">&gt;.</span>Hander</div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=RC5Cq0zAxCHc1sM9Uy3-2BojrrUAw-2F96zH69NULNHPvCt43lRAi6ntQA37nlmmQnQToVOI2RQC8ByWnnckJSxSprpHkg-2BE9XOwbuwfTBLgl3h5tMyvLLyqUnvBkOcTzBmGADwSzvpnFSpwkE13sJaFanti3ldjvvxkHw-2BPbmvDdm9Pivn-2F-2FeCHEDTDU3QClHbhgmAL8wQnaBxCQ8EVnC4-2FBZbXAbaBrUiGuOye25nQZDU-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<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></blockquote></div><br class=""></body></html>