Tags on some non-struct types #969
Replies: 4 comments
-
There is one issue with enum tags from a syntax perspective:
One solution could be to allow
|
Beta Was this translation helpful? Give feedback.
-
One issue with this approach is that conversion of string -> enum would be slow, unless the enum's data was stored in a hash table of some kind. It would not be as quick as enum -> string (or int <--> enum). |
Beta Was this translation helpful? Give feedback.
-
And should enum string values be unique? Or if they are being stored as purely integers internally which represents the index of the string, does the uniqueness matter? I would also make the name of the enum the default value. |
Beta Was this translation helpful? Give feedback.
-
One issue with the |
Beta Was this translation helpful? Give feedback.
-
Certain types, in particular enums, could benefits from tags. For example: enums could provide more useful metadata for each entry, such as a pretty print name where you need non-identifier characters, whether it's a duplicate value, or signal some other intent.
Beta Was this translation helpful? Give feedback.
All reactions