3 ms·
Isn’t that the first thing you would do if you add a new variant?
by dgb23 2y ago
Isn’t that the first thing you would do if you add a new variant?
- K0nserv 2y agoOnly if you remember, which you, or someone else, is bound to not eventually
- rty32 2y agoadded that every switch/if should handle this exhaustively. For any project with more than a few dozens of files, it is basically impossible to remember all the downstream code that uses the enum -- you have to track it down, or better, let compiler automate check all usages
- dgb23 2y agoBut you're not adding variants without a reason? You want them to have some effect. It's hard for me to think of an example where it would make even sense to "having to remember to handle the variant" rather than "handling the desired effect of the variant".
- K0nserv 2y agoPeople are stressed, get distracted, are tired, don't have complete knowledge etc. This is kind of like arguing that null pointers aren't a problem, you "just" have to check all usage of the pointer if you make it null. In practice we know solutions like this don't work
- weavie 2y agoHuge codebase. It was handled in 13 places, but they missed the 14th.