Some positive and negative comments after using rust for a while
This is really only based off of my personal experience using rust for a while (pet projects only though). I would like to hear some opinions from others. I'll try to keep it "schematic" and to the point.
Pros
- Safety really built into the language (not just the borrow checker, but the strong typing features, and option/result help a lot too IMO)
- Blending imperative and functional features
- Versatile Enums used as tagged unions
- Simple and powerful match & unwrapping semantics
- Simple and transparent error handling
- Generics and traits as ways to abstract, collapse and enforce a specific API
- Not so simple yet powerful macros (especially a fan of the derive-trait style, for e.g. Copy, Clone, Debug, makes for a very concise way of implementing things), good also for some light manipulation.
- Docs, cargo, language server?! Amazing developer experience!
- ... other aspects I probably forgot to mention
Cons
- Lifetime gets a bit hairy at times, but honestly probably for good reason most of the times (... until people just start wrapping anything with an arc mutex to not have to think about it I guess)
- Low level memory manipulation not ergonomic (like no pointer arithmetic for example, again, probably for good reason)
- Verbose trait implementations when deviating from the norm (this is not rust specific to be fair, same would apply to say operator overloading in C++) although Iterators traits are a bit too much.
- Annoying type conversion for primitive integer types (usize looking at you)
As you see the "cons" I could come up with, especially towards the language itself are basically absent or very shallow.
Nonetheless, there is one huge thing, which is not really about Rust, but rather about Rust code. Rust code IMHO tends to be extremely verbose, overly abstract, full of generics and traits overcomplicating by orders of magnitude the underlying logic and the overall lines of code and maintenance thereof.
Since, I believe, the language is so expressive and gives you so much freedom, and partly because of the almost OOPish way in wanting your own struct idiomatic (if you want it to behave as if it came from the stdlib) with all the traits people would expect and the API conventions (e.g. get, get_mut, builder pattern on everything, etc.), most the code I read and wrote for some time was, to be honest, simply way too much and too complex.
After using C for some time, it seems the simplicity of the language almost induces simpler thinking (perhaps paying some unsafety though!) to the developer.
In conclusion, I believe it is possible to write concise, robust rust code but it does not seem to be the norm.
Quoting Spiderman, "with great power comes great responsibility!".
What do you think? Am I being overly dramatic? Does that "verbosity" perhaps add something valuable that I do not see?