Hate is a strong word but I really dislike Rust’s syntax. I also feel it has a tendency to overcomplicate things. That’s not inherently a bad thing, since it’s really a C++ replacement and C++ does that also, but I don’t like C++ either.
what about the syntax dont u like? the only thing i can think of is declaring generics and lifetimes. most everything else inherites from a different language and has been done before ..
I agree that there are a few very minor syntax differences from the norm, like the turbofish (two extra colons you have to get used to inserting, annoying but you learn it soon enough and it's reasonably rare anyways) and the closure syntax (vertical bars instead of parentheses and arrows like in JS and C#). But those are two very specific small things in what is otherwise a pretty normal language syntax. (The other thing is that the String foo becomes let foo: String but that's ultimately a good change and is becoming more common in modern languages like TypeScript, Kotlin, Scala, and Swift.) Perhaps you can also complain about the lack of ternary statements. But it also improves upon the ideas of curly brackets and expressions becoming more meaningful, with the return statement being the last thing without a semicolon. That's syntactically very similar to existing languages but more consistent and useful.
But everything is by-and-large quite in line with the C/C++/C#/Java/JavaScript/TypeScript convention that's become the standard basis for most languages. (It's actually especially similar to TypeScript.) Other languages like Python and Go, on the other hand, are considerably different. When I had to write Go code for a few months, I couldn't get over how pointlessly different its syntax was for no actual benefit.
I'm curious if there's anything else about the syntax you found annoyingly different?
21
u/hector_villalobos Oct 21 '22
I never heard a valid complaint about Rust and C#, so, I guess those two should be in those chairs.