[swift-evolution] Generic `typealias`s

Douglas Gregor dgregor at apple.com
Fri Dec 4 22:35:13 CST 2015

Sent from my iPhone

> On Dec 4, 2015, at 4:08 PM, Joe Groff <jgroff at apple.com> 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.

I would rather not have such an umbrella, because how would one know what's in it and who gets to decide? Even "obvious" things need design, and some things that might sound like obvious goodness can benefit from review. ++ sounded like obvious goodness at one point in time, too. 

  - Doug

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

More information about the swift-evolution mailing list