[swift-evolution] [Pitch] Enum with generic cases

Kevin Nattinger swift at nattinger.net
Mon Apr 24 16:38:26 CDT 2017


> 
> How can I improve your understanding?
> 


Given the enum I was using earlier:

enum Thing {
    case thingOne<T>(T)
    case thingTwo<T>(T)
}

- Write a function that takes a thingOne<String> or thingTwo<Int> but nothing else.
- Declare a variable that can hold a thingOne<String> or thingTwo<Int> but nothing else.

Or explain why something that is widely used, trivial to write, and necessary for type safety should be removed from the language.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170424/3c8e3662/attachment.html>


More information about the swift-evolution mailing list