3 ms·
Honestly i miss the Java enums. Those can have constructors implement interfaces and what not. In Go i actually revert to the old C custom of adding a private
by LordHeini 6y ago
Honestly i miss the Java enums.
Those can have constructors implement interfaces and what not.
In Go i actually revert to the old C custom of adding a private length value at the end so i can iterate over all values.
Like so
type Color int
const (
Blue Color = iota
Green
Red
limit
)
for i := Blue; i < limit; i++ { ... }
Go really needs proper enums...