On 9 July 2025 17:12:52 BST, Rob Landers <rob@bottled.codes> wrote: > I’ve been thinking of a “quality-of-life RFC” for obvious enums, for some > time now. Basically, backed enums without a value receive the “obvious” > value. So a string backed enum gets the name, while an int gets the ordered > number.
I agree that this is a more fruitful direction. It allows users to say "the value of this case *happens right now* to match its name", but still keeps name and value as strictly separate concepts. Importantly, it should be possible to mix default and non-default values on one enum, for refactoring, e.g. you might want to change an auto-valued "case ZendFramework;" to an explicit "case Laminas='ZendFramework';" or "case ZendFramework='Laminas';" without rewriting all the other cases on the enum. It could even be a specific short-hand syntax on the case, like "case ZendFramework = auto" or "case ZendFramework = _". Rowan Tommins [IMSoP]