News for hackers. Stuff that matters.
Re:Using enums to represent state in Rust by k_g_b_ on Friday September 22, 2023 @05:29PM (#37618036)
Ceylon had a really neat type system - sadly it didn't take off. However before that these types in particular were a feature of OCaml: https://v2.ocaml.org/manual/polyvariant.html There they're called Polymorphic Variants. Note also the implementation efficiency concerns on that page - given that Rust is a systems language, defaulting to the current sum types instead of set-theoretic unions was a reasonable choice. Having the option to use them natively and without macros (there's some crates) would be nice still when aware of the additional performance overhead.

There are no comments on this comment yet.