The borrow checker makes things a bit more complicated to get running, definitely takes some getting used to when you come from a non-memory safe language. But the compiler is really helpful throughout almost all mistakes, often directly providing an explanation and a suggested fix. One of my favorites programming experiences so far
…definitely takes some getting used to when you come from a non-memory safe language…
I actually think it’s more like the opposite. The compiler takes the normal rules you apply to avoid issues with a non-memory safe language like C/C++ and enforces them explicitly where memory safe languages don’t have those rules at all. I think lifetimes are much more confusing if you’ve never dealt with a user after free and usually let GC deal with it.
Also yes the compiler warnings and errors are amazing, the difference between rustc and gcc is night and day.
The borrow checker makes things a bit more complicated to get running, definitely takes some getting used to when you come from a non-memory safe language. But the compiler is really helpful throughout almost all mistakes, often directly providing an explanation and a suggested fix. One of my favorites programming experiences so far
I actually think it’s more like the opposite. The compiler takes the normal rules you apply to avoid issues with a non-memory safe language like C/C++ and enforces them explicitly where memory safe languages don’t have those rules at all. I think lifetimes are much more confusing if you’ve never dealt with a user after free and usually let GC deal with it.
Also yes the compiler warnings and errors are amazing, the difference between rustc and gcc is night and day.
I can confirm, I’ve never used a non memory managed language, and the Rust borrow checker is a massive kick in the teeth
But, the more i consider it from the perspective of memory, and pointers, the borrow checker makes a lot of sense
Especially when storing references inside structs, and how mutability affects references
I actually figured out i could fix a re-mutable borrow error by performing the two mutable operations in separate for loops