[swift-evolution] Proposal: An Either Type in the STL

Matthew Johnson 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.
> 
> -Thorsten
> 
> _______________________________________________
> 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/20151212/1895d4ed/attachment.html>


More information about the swift-evolution mailing list