[swift-evolution] Generic `typealias`s

Chris Lattner clattner at apple.com
Fri Dec 4 18:07:07 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

Yes, this is definitely something that I (at least) would like to see.  Patches welcome :-)

-Chris


> 
> 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
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list