My previous proposal was pretty well received, but @networkimprov had mentioned that I'm solving three separate problems at once, rather than addressing them separately. I think that's an important thing to consider, so hopefully this new proposal addresses this. This proposal is largely inspired by my previous proposal, so I very highly recommend reading that on to see the design philosophy. golang/go#28987
That proposal also goes over how other languages handle enums, and how we can learn from them.
The problem with non-namespaced variables is largely illustrated in my previous proposal, but to summarize, if my mat
package has a Material
enum and a Hardness
enum in my package, I would want these things to be separated into mat.Material.Metal
and mat.Hardness.Hard
values, rather than just mat.Hard
and mat.Metal
being in the same namespace.