[swift-evolution] Proposal: An Either Type in the STL
matthew at anandabits.com
Sat Dec 12 13:11:57 CST 2015
I don’t have any experience working in a language with structural sum types but I think inference of structural sums in different branches of a conditional would lead to a lot of bugs and potential confusion. Before considering support of such inference I would want to see pretty compelling evidence that it adds value and doesn’t lead to problems.
In absence of allowing this inference, the structural sum could be specified manually if that is what is intended.
> On Dec 12, 2015, at 12:48 PM, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
>> Am 10.12.2015 um 20:59 schrieb John McCall via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
>> Also, are we allowed to *infer* structural sums? For example, can we decide that the type of (x ? A() : B()) is A+B if that’s the greatest common type?
> That’s what Ceylon does.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution