[swift-evolution] Generic `typealias`s

Joe Groff jgroff at apple.com
Fri Dec 4 18:08:57 CST 2015


> On Dec 4, 2015, at 3:04 AM, Dapeng Gao <gdapeng at icloud.com> wrote:
> 
> It would be handy if Swift can support generic `typealias`s, which would probably look like this:
> 
> typealias Handler<Element> = [Element] -> Void
> 
> One common way to achieve this is to define a generic `struct` and use a nested `typealias`:
> 
> struct HandlerWrapper<Element> {
>     typealias Hander = [Element] -> Void
> }
> 
> HandlerWrapper<SomeType>.Hander

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.

-Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151204/27240f64/attachment-0001.html>


More information about the swift-evolution mailing list