[swift-evolution] Type information containing multiple additional protocols

Matthew Johnson matthew at anandabits.com
Wed Dec 16 09:05:37 CST 2015


> // require value to be of type Bool OR Double OR String OR SomeProtocol
> let value: (Bool | Double | String | SomeProtocol)
> switch value {
>    case let _ as Bool: …
>    case let _ as Double: …
>    case let _ as String: …
>    case let _ as SomeProtocol: …
>    // no default necessary
> }

This is a structural union type which has received considerable discussion with commentary from core team members already in the with a subject something like "STL and Either".  You may be interested in reading that discussion.  The summary is that we are unlikely to see it without extremely compelling use cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/c625e80b/attachment.html>


More information about the swift-evolution mailing list