5 ms·
Wouldn't an enum in go not only be different in what the reflections API sees behind the scenes? In the sense that it first points to the type, and then to the
by cookiengineer 2y ago
Wouldn't an enum in go not only be different in what the reflections API sees behind the scenes?
In the sense that it first points to the type, and then to the value, similar to how other newer types are already implemented?
type whatever enum {
value1 iota
value2
}
enum would just be a similar shorthand to uint or whatever you want to identify it uniquely.
I don't see much problem implementing this apart from the methods in the GC that have to be touched to trace the object tree correctly.
The comparison handling must be touched in either case, so I don't think an additional pointer to the enum's definition there counts as much work.