4 ms·
>"rich enum type" (whatever that's called) Algebraic data types, or sum types, or discriminated unions. GP also forgot to mention that Rust (among other langu
by throwaway8941 6y ago
>"rich enum type" (whatever that's called)
Algebraic data types, or sum types, or discriminated unions.
GP also forgot to mention that Rust (among other languages with support for ADTs) force you to handle all possible values, so you simply can't forget to handle an error.
- steveklabnik 6y ago(They're called 'enums' in Rust though, your parent is correct.)
- thatswrong0 6y ago> so you simply can't forget to handle an error. This is such an important point, and I know people may think its outrageous that this could happen, but I work with a bunch of talented programmers, and still we've had the occasional bug crop up in our Golang codebase where we have a `val, err = doSomething()` without an ensuing `if err != nil { }` check which was missed by the programmer and by the reviewer. Or even better, we've had `val, _ = doSomething()` occur, the result of debugging to get around the unused variable compilation error. It's 2020. Just like nil-pointers, this is an issue that is for the most part _solved_ and shouldn't exist in modern languages. Our programming languages should be constructed with the fact that we're fallible humans in mind.