[swift-evolution] Generic `typealias`s

Kevin Ballard kevin at sb.org
Fri Dec 4 19:29:56 CST 2015


I've filed a ticket on bugs.swift.org to serve as a hint to any
interested party that this is something that is actively desired and
patches are welcome.

https://bugs.swift.org/browse/SR-64

I figure that's probably the right course of action for obvious
improvements that we know we want but aren't candidates for the full swift-
evolution process.

-Kevin Ballard

On Fri, Dec 4, 2015, at 04:08 PM, Joe Groff wrote:
>
>> 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
>
>
> _________________________________________________
> 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/ec386144/attachment.html>


More information about the swift-evolution mailing list