3 ms·
> it's one of those features that outside of Rust you only really find in ML-family languages Or in Scala, technically not an ML, but is as close as you'll get
by virtualwhys 4y ago
> it's one of those features that outside of Rust you only really find in ML-family languages
Or in Scala, technically not an ML, but is as close as you'll get in a nominally typed language.
enum RGB:
case Red, Green, Blue
def log(x: RGB) = x match
case Red => print("red")
case Green => print("green")
// error, not exhaustive
Obviously Scala can do a lot more, including GADTs, which Rust will never have until HKTs are supported.
Ton of powerful languages to choose from these days, good times...