Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
mcguire
· 6y ago · 0 comments
On the other hand, Rust's RAII management model behaves similarly to a reference counting system where the counts are limited to 0 and 1 (well, for a loose approximation of the 0 state), right?
Comments
[–]
steveklabnik
6y ago
Some people say this, but I think it's misleading; refcounting can make things live longer, but the borrow checker cannot.
[–]
Jweb_Guru
6y ago
Well, with ownership, a move can make things "live" longer, I guess.
[–]
steveklabnik
6y ago
You're not wrong. I just think there's enough difference that the analogy doesn't really work.
[–]
ta20200202
6y ago
RAII for references (pointers) is a no-op. If the cache returns references to the data in its own array there is no overhead.