3 ms·
Explanation for enumeration: the thing about enumeration is you can ensure that you do an exhaustive handling of all cases in a switch statement. If an enum cha
by illusive4080 3y ago
Explanation for enumeration: the thing about enumeration is you can ensure that you do an exhaustive handling of all cases in a switch statement. If an enum changes in a future library version you can get a compile error wherever the enum is enumerated in code which helps you handle new cases due to new features in a library. Go can’t do that.
- randomdata 3y ago> the thing about enumeration is you can ensure that you do an exhaustive handling of all cases in a switch statement. You’re thinking of sum types, or at least something like what Pascal has which is a variant on sum types only with support for integer tags. That’s not a property of enumeration. Enumeration is simply about numbering. Literally the dictionary definition.