I don't know if there has been any internal discussion about using union-types
instead of enums, but afaics, there are no obvious downsides for that approach.
> I'm a little curious as to why union types keep on coming up, when enums can
> do everything they can and much more (methods, constraints on generic types,
> conformance to protocols).
Are there any strong reasons why those features would not be possible with
union types?
There has been a discussion started because it is a little bit cumbersome to
create enum-properties (and methods).
With unions, there would be no need for all those switch-statements, and would
be possible to configure cases in a central location.
There has also been a proposal for "anonymous enums", which could be modeled
with unions in a very elegant way.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution