[swift-evolution] [Fake-Proposal] Remove enums with associated objects

Robert Widmann devteam.codafi at gmail.com
Mon Feb 20 14:33:46 CST 2017


A lot of problems look algebra-like.  Best to have sums and products at your disposal.

 Cheekily,

~Robert Widmann

2017/02/20 15:07、Tino Heth via swift-evolution <swift-evolution at swift.org> のメッセージ:

> Obviously, this won't become an accepted proposal -  neither the time nor the author would be appropriate for such a result.
> But the list seems a little bit bored lately, so maybe a relaxed discussion without practical implications isn't the worst thing to have now ;-)
> 
> Several current threads seem to cry for sum types, so imho it is a valid question what's wrong with them, and why Swift prefers enums instead.
> 
> I'm sure such a debate already happened, but I haven't seen its arguments... and the ones that come to my mind don't fit to reality:
> Enums might be more powerful, but imho Optional<Optional<T>> feels more like a burden.
> Sum types, on the other hand, can be composed on the fly and could save us from several, incompatible implementations of trivial things like Result or JSONValue.
> 
> So, what is the big advantage of enums?
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list