4 ms·
General programming languages theory question, is one supposed to iterate over enum entries or is that considered an antipattern? I have found myself needing to
by DanielHB 2y ago
General programming languages theory question, is one supposed to iterate over enum entries or is that considered an antipattern? I have found myself needing to do that a few times and it always felt a bit dirty.
- panstromek 2y agoI wouldn't say it's an antipattern. E.g. listing all possible values of some user input field is a pretty natural use case for that.
- williamdclt 2y agoNo that’s fine and a reasonable thing to do . In fact, I’d say it is one of the main points of enums and one of my biggest gripes against Go is the lack of that capability