Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's that as well, but that part of the description doesn't catch how objects are automatically freed once the last reference to them (the owning one) is dropped.

Meanwhile my description doesn't fully capture how it guarantees unique access for writing, while yours does.



> but that part of the description doesn't catch how objects are automatically freed once the last reference to them (the owning one) is dropped.

You're confusing the borrow checker with RAII.

Dropping the last reference to an object does nothing (and even the exclusive &mut is not an "owning" reference). Dropping the object itself is what automatically frees it. See also Box::leak.


No I'm rather explicitly considering the joint behavior or the borrow checker and RAII.

With only RAII you don't get the last reference part.

Yes, there are exceptions, it's a roughly correct analogy not a precise description.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: