The problem of enum
variants being used out of context already exist via use
(and re-exports can further obfuscate what is used). Code authors can always make bad choices and write hard to understand code, but when someone publishes code on a website, it's in their interest to make it readable, so you can expect them to choose a syntax that is clear. The long fully-qualified version will always exist, and be available where needed.
When the abbreviated syntax is a normal part of the language, you can expect authors to start taking it into account. When the current syntax is EnumName::Variant
, then people designing APIs might want to avoid repeated words, and maybe name variants like AreDogsGood::Yes
. But when the alternative syntax becomes a supported option, authors will have to consider it, and name things accordingly, like WhoIsGood::DogsAreGood
, so that users can write .DogsAreGood
instead of .Yes
. This is already the case in Swift — .
syntax is common, so APIs don't suffer because of it, the APIs are designed to be most clear with it.
The important aspect is that it can improve readability. It can even improve readability over current Rust status quo, because better enum
ergonomics may encourage API designers use enum
instead of bool
and other alternatives.