[swift-evolution] Type information containing multiple additional protocols

Marc Knaup marc at knaup.koeln
Wed Dec 16 09:16:40 CST 2015


Enumerations are a good example.
Or JSON nodes.

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/002474.html
On Dec 16, 2015 16:05, "Matthew Johnson" <matthew at anandabits.com> wrote:

>
> // 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/c2273bed/attachment.html>


More information about the swift-evolution mailing list