Re:What I'd like to see in Go 2.0
by rplnt on Friday February 04, 2022 @10:41AM
(#30208200)
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.
[ Parent
| on HN ]
Ada 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/Enumerat...
The 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".