HNHacker News
TopNewBestAskShowJobs

suremarc

53 karma · joined November 9, 2021

submissionscomments
suremarc··on Safer Enums in Go
This is cool, but it doesn't seem like Switch is implemented for Int, and the use of runtime reflection limits the contexts in which this implementation can be used, compared to a language construct that gets compiled into efficient machine code. I wouldn't want this to be endemic in my codebase or my dependencies.
suremarc··on Safer Enums in Go
Am I the only one missing in the last example that the zero value, FlagID{}, would be an invalid enum? In which case this is not fundamentally different from the other cases, where you always have to check for the possibility of an invalid value.
← PreviousPage 2 of 2