4 ms·
Every time I see discussion about go and enums there are people who are referencing these mythical C-like enums that had never existed. It's some sort of constr
by rplnt 5y ago
Every time I see discussion about go and enums there are people who are referencing these mythical C-like enums that had never existed. It's some sort of constructed memory. And I'm sure there are languages that do enums "properly", but it's always C/C++ that is referenced.
- masklinn 5y agoThe point here has little to do with Go, which you can see by the quote it replies to having nothing to do with go: > We use enums heavily to force devs who use our code into good choices the note is that this is very much language-dependent and there are languages which get it very, very wrong. > And I'm sure there are languages that do enums "properly", but it's always C/C++ that is referenced. That makes no sense, the original comment obviously assumes a language which does it "properly".
- rplnt 5y agoSorry, my comment wasn't trying to address (let alone bash) the original comment in any way here, just a tangent based on your note about C# enums.
- 13415 5y agoAda does them well. They have attributes that allow for converting to and from integers and strings [1], and case statements have to be exhaustive or use a default "others" clause. [1] https://en.wikibooks.org/wiki/Ada_Programming/Types/Enumeration https://en.wikibooks.org/wiki/Ada_Programming/Types/Enumerat...