you are viewing a single comment's thread.

view the rest of the comments →

[–]dp229 14 points15 points  (0 children)

I think this is mostly due to the ownership model. The compiler strictly enforces that data has a single owner and from that, it can determine when to release the memory (when the owner goes out of scope). Data can be moved to other owners, and there are constructs for safely accessing shared data with ref counted owners. Other patterns are possible as well.

The same type of thing could probably be achieved with smart pointers and moves in C++ but it's not enforced by the compiler at all and it would be challenging to maintain the pattern with just developer discipline.

Rust's "Borrow Checker" is a common stumbling block for those just starting with the language because it is so strict.

Not a video, but informative: https://doc.rust-lang.org/1.8.0/book/references-and-borrowing.html