4 ms·
That’s the case for algebraic data types in Go. Otherwise you need to remember the impossible states whenever you change the code. It’s worse if some more compl
by kubb 2y ago
That’s the case for algebraic data types in Go. Otherwise you need to remember the impossible states whenever you change the code. It’s worse if some more complex fields only make sense in a specific state. Enums can’t help there.
Languages in the ML family solved this decades ago. But in the last 30 years this didn’t go mainstream.
- masklinn 2y ago> But in the last 30 years this didn’t go mainstream. It's started to in the last few years (last decade?). First OO languages started getting type-safe enums, which still suck but at least aren't as bad as C-style enums, then most recent languages got either actual sum types or something more or equivalent (type-safe unions, sealed classes / interfaces).
- School-Cotton 2y ago> Languages in the ML family solved this decades ago. But in the last 30 years this didn’t go mainstream. Rust is mainstream.