4 ms·
This is one of my last remaining nitpicks with Rust as a language. In Scala, sum types are a form of sub-type polymorphism, where each variant is its own distin
by saosebastiao 10y ago
This is one of my last remaining nitpicks with Rust as a language. In Scala, sum types are a form of sub-type polymorphism, where each variant is its own distinct type and can be used as such. To get similar behavior in Rust, you end up having to wrap structs in the variant like this:
struct Foo_
enum Bar { Foo(Foo_) }
It works, but it is extremely annoying.