<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 <<a href="mailto:gdapeng@icloud.com" class="">gdapeng@icloud.com</a>> 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<Element> = [Element] -> Void</div></div><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<Element> {</div><div style="margin: 0px; font-size: 18px; font-family: Menlo;" class=""> <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>] -> <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=""><</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">SomeType</span><span style="" class="">>.</span>Hander</div></div>
</div></div></blockquote><br class=""></div><div>Definitely. I'd say this falls under the (totally arbitrary) umbrella of "obvious things that we didn't get around to implementing yet" instead of formal changes to the language. If you (or anyone else!) were to implement this, we'd consider the pull request immediately.</div><div><br class=""></div><div>-Joe</div><br class=""></body></html>