With Rust you need to be explicit about everything's lifetime. You cannot allocate some chunk of memory and freely borrow it; when borrowing you need a certificate (i.e. compiler check) that the borrowed reference has a shorter lifetime than that of the referenced memory. It is tremendously different from the absence of such guarantees (like C) or the GC-based weak guarantees (like Java and Go, which does not solve the logical memory leaks anyway [1]).
[1] Not that Rust completely solves the logical memory leaks, but it makes the leaks explicit.
c++ smart pointers under the hood? its actually cool.. to bake some of this directly in the language.. can prevent some memory copying by playing with raw pointers indirections under the hood in the lang runtime, etc..
But you already has to think like this when you use smart pointers in C++.. "who owns this reference?" etc..
But in C++ this is a library.. not a syntax.. point to rust for this
lifthrasiir|12 years ago
[1] Not that Rust completely solves the logical memory leaks, but it makes the leaks explicit.
oscargrouch|12 years ago
But you already has to think like this when you use smart pointers in C++.. "who owns this reference?" etc..
But in C++ this is a library.. not a syntax.. point to rust for this