by hardwaresofton · 2y ago · 0 comments
Zig and Swift do it and I feel like it makes things harder to read, not easier.
`.variant` vs `Type::Variant`
IIRC the syntax is optional (you can include the type name) but it seems obvious that in any sufficiently long or complex code, not having the type name close would be annoying, especially if you didn’t have IDE like capabilities in your editor.
That `.variant` syntax is annoying as hell to dig through when you don't have an IDE to rely on for jumping around. Rust (or your choice of other more explicit language) is just generally way more clear about what's being used.
The way I usually settle on describing it is that this feature solved for people writing code, but code is read more than it's written, and thus I don't believe this tradeoff was worthwhile.
Do you have a link for an RFC or GitHub issue or anything? Would be curious to see.
Example in the playground: https://play.rust-lang.org/?version=stable&mode=debug&editio...
{
use MyEnum::*;
match my_enum {…}
}