Common state values have very well known bussiness logic spelling
and are wrotten many times in code,
otherwise special uncommon enum values much rarely
There is no benefit to write SomeSpecificField1.GONE many times
but have posibility to write VISIBLE_FIRSTLY once
Which GONE must be used for the 1st occurrence? The compiler can only determine that by checking whether someExtensionFunctionReturningTheCorrectEnum() exists for one of the enum types. What should happen if that function is defined for both enum types? If multiple function calls, conditionals, etc. are chained, how far does the compiler need to infer the types used in the expression to determine the type of the identifier with which the expression is started?
I have a similar situation - I have many different Enum classes representing the state of different entities. Since the Enums are specific to the entity they are a nested class of the entity in my model.
That makes it even more verbose to write the enums, even for all those cases where there can be no ambiguity because it’s used in an assignment or when() clause, as I have to write out the full path for something like Shift.State.PUBLISHED !
I seem to be forever linking to the recent future features survey though the truth is that solutions to most of the things which people consider to be ‘pain points’ in the language, are currently under consideration and ‘short notation for enum constants’ (item 3 on the list) is one of them.
I can certainly see the sense of this when an enum is the subject of a when statement / expression or if you’re initializing an enum variable (or parameter) with some value.
I don’t know whether this is likely to be implemented but, if it is, then the problem for the designers will clearly be to try to restrict it to situations where the enum type you’re referencing can be readily inferred by both the compiler and the human reader.