4 ms·
Accidental zero value enums are a constant plague as far as I've seen. Almost any defense is worth it.
by Groxx 3y ago
Accidental zero value enums are a constant plague as far as I've seen. Almost any defense is worth it.
- arp242 3y agoYeah, this is the big thing. Honestly I'm not so worried about people using pkg.fun("red") or pkg.fun(25) instead of pkg.fun(pkg.Red) if they really want to, and in some cases it's IMHO even fine (e.g. HTTP status codes, where everyone knows what 404, 500, etc. mean). It's pkg.fun(someVar) where someVar is accidentally 0 or "" because it comes from 3 functions away.
- the_gipsy 3y agozero-values are the root of all go problems. Lack of sum/union/algebraic types are the root if zero-values.