4 ms·
The nice thing about Rust is you often don’t have to declare the type of a variable since the compiler will just infer it for you. This is especially nice in an
by CDSlice 6y ago
The nice thing about Rust is you often don’t have to declare the type of a variable since the compiler will just infer it for you. This is especially nice in an IDE like CLion which will show you the inferred type for each variable. As for the syntax for a type declaration, `variable: Type` is more natural and readable for me than `type variable`. The first one naturally reads as `variable is a Type` while the second reads like Yoda speak (`A Type, variable is`)
Since I am not familiar with Scalia, I am not sure why the types after the name would end up being more verbose, as far as I can tell the only difference is the : between the variable and its type. Would you mind expanding on that?
Personally although Rust definitely does not have the elegance of Haskell or Python, I definitely would not call it ugly. There aren’t that many symbols and once you actually spend the time to learn the language the semantics for each syntax element are pretty easy to remember. I also have looked at D, but the lack of algebraic data types makes it a non-starter for me.