Re:Java 12
by antpls on Wednesday March 20, 2019 @02:53AM
(#19439658)
From my understanding of Rust, you will still pay the runtime cost of destruction and deallocation of objects with the object lifetime system ? It's like reference counting, but precomputed by the compiler. Please correct me if I'm wrong.
[ Parent
| on HN ]
Re:Java 12
by steveklabnik on Wednesday March 20, 2019 @08:06AM
(#19441225)
The way the "it's like reference counting" mental model goes wrong is that things don't live arbitrarily wrong. Reference counting is used to extend the life of things, Rust will not do that.
But yes, it's malloc and free.
Re:Java 12
by unrealhoang on Wednesday March 20, 2019 @06:08AM
(#19440562)
It’s like manual allocate/deallocate. Only that the compiler will insert free (or drop, in case of Rust) for your variables when it reaches end of scope.
Re:Java 12
by DaiPlusPlus on Wednesday March 20, 2019 @03:18AM
(#19439752)
Right. It’s just easier to reason about the process with Rust’s ownership system compared to a reference-counting or GC system.