4 ms·
These are subjective things. I don't consider Rust syntax perfect, but I don't these suggestions as way to improve it substationally. If you want to get rid of
by Ygg2 3y ago
These are subjective things. I don't consider Rust syntax perfect, but I don't these suggestions as way to improve it substationally.
If you want to get rid of `::` and `;` and braces you have to look at the fallout of those decisions.
Braces are imo much better at being robust than whitespace.
def Foo[T]:
t: T
size: u32 // invisible error here because someone used tabs by mistake
`;` disambiguate expression vs statement. If you remove it you need way to differentiate between them.
Another problem with `import foo.bar.baz` is how will you distinguish between a method call or a type declaration? E.g. `std.option.Option.Some` what is this? Type? Method? Module?
What is `std::f64::consts`???
Not to mention you kinda have to have compiler in mind, if syntax is ambigous you're going to have a very bad time.
- weinzierl 3y agoI agree with that and would not want to see braces and semicolons go because they are pretty conventional. In this case Python and Javascript/Typescript are the outliers. It's the opposite for the double colon syntax which, apart from Rust, to the best of my knowledge only exists in C++ (for good reasons) and some functional languages for a completely different purpose. Honestly curious question: What fallout would you see from replacing it with a dot in Rust. I immediately see no disambiguation issues, but I'm not a compiler writer.
- JodieBenitez 3y ago> // invisible error here because someone used tabs by mistake would not parse, so no invisible mistake.
- Ygg2 3y agoImplying every site you post code to will have correct syntax highlighter.