|
|
|
|
|
by Ar-Curunir
2197 days ago
|
|
Rust has both generics and sun types, and benefits enormously from both. And sum types aren’t for “radically different types”. You can define an error type to be one of different options (I.e. a more principled error code), or to represent nullability in the type system, or to indicate fallibility without relying on exceptions, etc. Rust uses all of these to great effect, and does so because these sum types are generic. |
|