4 ms·
If I ever implement a product from scratch again, discriminated unions with compiler enforced exhaustive pattern matching is a hard requirement. It’s too powerf
by klysm 2y ago
If I ever implement a product from scratch again, discriminated unions with compiler enforced exhaustive pattern matching is a hard requirement. It’s too powerful to not have.
- nmfisher 2y agoUnion types are my biggest wish for Dart, but unfortunately it doesn't look like they'll be added any time soon. They've recently added support for compiler-enforced pattern matching over sealed classes, which I suppose does get you halfway there though.
- actionfromafar 2y agoWhat languages could fit that description today? I don't really understand what it even means but maybe I could understand better if I could look at examples in languages which have them.
- phi-go 2y agoFor example Rust: https://doc.rust-lang.org/std/keyword.enum.html https://doc.rust-lang.org/std/keyword.enum.html
- jghn 2y agoAlso Scala
- seivan 2y agoSwift, Typescript depending on your opinion with structural typing, and Rust. Think Scala, Elm and Haskell have it as well. Having that and elixirs pattern matching would be insane.
- seivan 2y ago[dead]