← Back to context

Comment by afdbcreid

7 hours ago

That is called an index. If you want it to be standalone, you can bundle it with the ArrayList.

I think parent was after base+offset+index rather than just base+index.

Examples would be eg, `string_view` or `ArraySegment`. They hold some offset relative to a base allocation, and when we index the string_view or ArraySegment we're indexing relative to that offset.

I wish languages made it easier (or possible) to track index ownership at compile time.

  • You can in Rust! You just bundle it with a lifetime.

    But... This loses the reason people are using indices to begin with: because the borrow checker cannot track what they do.