2 ms·
Until 2012, Rust 0.6 required a postfix `.` on enum variants: https://github.com/rust-lang/rust/commit/04a2887f879 https://github.com/rust-lang/rust/commit/04a
by pornel 2y ago
Until 2012, Rust 0.6 required a postfix `.` on enum variants:
https://github.com/rust-lang/rust/commit/04a2887f879 https://github.com/rust-lang/rust/commit/04a2887f879
And here's a 2013 bug for the ambiguity:
https://github.com/rust-lang/rust/issues/10402 https://github.com/rust-lang/rust/issues/10402
- sundarurfriend 2y agoI was just about to comment that it's unfortunate that languages seem to have settled on the (false) dichotomy that enum variants should be either `MyEnumName.variantname` or just plain `variantname`. Often, you want enum variants to read almost like inbuilt literals, as that leads to more readable "natural-sounding" code than needing to say `MyEnumName.variantname` every time. However, having them actually be bareword literals leads to both ambiguity while reading and to long term maintainability issue like the one in the post. Postfix `.` may or may not be a great syntax specifically, but something like it still seems like a great compromise between these two extremes. Do you know why the syntax was decided to get axed? Is this part of a larger PR where the decision is elaborated upon?