News for hackers. Stuff that matters.
Re:Enums in Go by gray_-_wolf on Friday July 12, 2024 @06:14AM (#40944193)
As long as the set is limited (as enums usually are), you can always go with the middle ground between omitted case and catch all:

    case FILE_NOT_FOUND:
        /* This is normal, nothing to do. */
        break;
This should still catch adding new value into the enum and not handling it.
Re:Enums in Go by ReleaseCandidat on Friday July 12, 2024 @06:19AM (#40944219)
I should have added that this solution stops working as soon as you're handling 5 out of 50 cases. Lexical tokens are which always trigger the mentioned problems in my code - often you match against subsets, are there are _way_ too many of them to add them all explicitly.