Never realized that global can’t be constants. Is there a simple reason for that I’m missing?
I honestly don’t know what they mean, you can export constants, and you can have package level constants. Is there some global scope above that which can only be variable and not constant?
In the two common ways to do enums that he mentions, the custom types used for FlagID are just strings and ints, which can be constants, but in the new way he’s suggesting making FlagID a struct type, which cannot be a constant. This means your global/package-level enums can be overwritten by whatever code imports your package, whereas the “common” ways are using constants which can’t be overwritten.
Right, I knew that there were numeric and string contants, and that more complex types (structs, etc) couldn’t be constants. Rereading the paragraph in the article, I had misinterpreted it the first time as stating that any global thing had to be variable, which is obviously wrong. Hence my confusion.