3 ms·
One could say that the point of a borrow checker is to guarantee that you don't deallocate an object until all references to it are gone (for some definitions o
by verdagon 5y ago
One could say that the point of a borrow checker is to guarantee that you don't deallocate an object until all references to it are gone (for some definitions of deallocate and object).
- andrewflnr 5y agoIn my experience the annoying clashes with the borrow checker are more to do with mutability than de-allocation. It's not that the reference lasts longer than the allocation, it just overlaps other borrows you want to make.
- ncmncm 5y agoRight. At any point that an object could possibly be deallocated, everybody who wanted to look at it has, perforce, already lost interest. The system knows at what point this is, and can quietly dismantle the object and free its storage without bothering the programmer.