DEV Community

Discussion on: My first impressions of Rust

Collapse
 
infensus profile image
Dominic • Edited

I really wanted like Rust and I do like several things. Honestly I just find the compiler annoying, it treats all code as if it could be multi-threaded even if it's not - so you have to jump through hoops and hours of learning about things like Arc, Rc, Cell, RefCell, Box, RwLock etc, not to mention the infuriating rules around lifetimes and borrowing.

Simple fact is that these data structures are inefficient and Rust advocates get aggressively defensive over anything Rust, they will tell you things like "A reference counter and dynamic borrow checking is hardly any difference"... yes it is. And they will tell you "Just copy it, it's just 2 fast shallow copies to read and write the value back". We are often talking about systems where nano seconds matter here, otherwise I'd just go and use something like Go. So yes it matters.

C and C++ is much more intuitive to me (ok C++ has a lot of features, some that's missing in Rust), but they are much easier to build a mental model about. I don't need a compiler to whine at me for holding 2 references to an object - that is organic and necessary in many situations (e.g. two data structures that can reference an object efficiently for different operations). And 99% safe on a single thread but Rust will force you to spend hours looking for less efficient solutions. The module system in Rust is also bizarrely over engineered.

The best thing about Rust is Cargo. If C++ had a Cargo equivalent there would be no contest for me.

To me Zig is a much more promising language but not stable yet - ziglang.org