[swift-evolution] [Pitch] merge types and protocols back together with type<Type, Protocol, ...>

Austin Zheng austinzheng at gmail.com
Sat May 14 13:22:23 CDT 2016


Union types are to enums as tuples are to structs. There's room for both in
the language. Sometimes it makes sense to have a more formalized construct
that has specific semantics (like an error type) and methods that operate
upon that type. Sometimes, you just want an int OR a string.

On Sat, May 14, 2016 at 10:58 AM, Tino Heth via swift-evolution <
swift-evolution at swift.org> wrote:

>
> > func f(obj: A&B&C) {..}
> > if obj is A&B&C {...}
> > obj2 = obj as! A&B&C
> >
> > (but I still don't understand real use case of things like (String |
> Int))
> Ceylon has already been mentioned: It uses the concept for its optionals.
> Swift uses enums, and those could be made obsolete by union types.
> _______________________________________________
> 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/20160514/380bfbf9/attachment.html>


More information about the swift-evolution mailing list