Re:Goenums: Type Safe Enum Generator for Go
by ikiris on Saturday April 26, 2025 @10:11PM
(#43808925)
it kind of does and doesn't
[ Parent
| on HN ]
Re:Goenums: Type Safe Enum Generator for Go
by saghm on Saturday April 26, 2025 @10:43PM
(#43809043)
I'm not sure what you mean by this. It definitely doesn't have enums, not even in the C sense of "type alias for integers with names for specific constant values. Yes, it has iota, but that's orthogonal to enums; you could use it to define bitmasks, for example. While you can certainly use it in combination with a type alias to make something resembling an enum, I'd argue that's still not actually "having enums"; you could do the same thing in C with typedefs and constants even if it didn't have enums.
I hardly consider the iota / const dance meaningful, it is like telling macro assemblers kind of have.
Granted, Niklaus Wirth removed them from Oberon-07, then again even as big fan of his work, that isn't the Oberon version I prefer, rather Active Oberon.