I have come from C++. I am used to its memory models. Now Rust. (loving it!)
I get what the borrow checker is doing until I do not. What has really got me worried is lifetimes. I recently wrote some code that was IMO syntactically and semantically correct. But for what seemed to me random reasons to do with lifetimes it did not compile. Then I made what still seem to me to be random changes (including
edition = "2018" whatever that is!) and now it compiles.
I have read the book’s chapters on lifetimes. I have asked many random questions here about life times. I have read a few blog posts.
I am confused. Deeply puzzled. I am inserting life times, almost at random. When the compiler accepts it, I stop. This is not sustainable!
So my question is to people who, like me, have come to Rust from C++ and have had to learn lifetimes and learn to love the borrow checker. What resources have you found useful?
I am wistful for
The Design and Evolution of C++ and
The C++ Programming Language by Bjarne Stroustrup . The illuminated so much for me back in the day…