←back to thread

Indices, not Pointers

(joegm.github.io)
102 points vitalnodo | 1 comments | | HN request time: 0s | source
Show context
skulk ◴[] No.45111204[source]
This is a very tempting and commonly used strategy in Rust to bypass the borrow checker. I've used it to implement tries/DFAs with great success (though I can't find the code anymore)
replies(3): >>45112462 #>>45112631 #>>45114374 #
bombela ◴[] No.45112462[source]
You don't bypass the borrow checker. Instead you use it the way it wants to be used.
replies(1): >>45112692 #
lmm ◴[] No.45112692[source]
Often you are bypassing it. E.g. if you rebalance a tree then references into that tree may now be invalid, so the borrow checker will prevent you from doing that while you have live references. But you may also invalidate indices into the tree, and the borrow checker can't help you with that.
replies(1): >>45114343 #
1. skeezyboy ◴[] No.45114343{3}[source]
> and the borrow checker can't help you with that.

good thing youve got a brain in your nut then