Language design question: I wonder if we can replace or supplant the notion of "lifetimes" in languages like Rust with a notion of "parent objects" (or "context objects").
In Rust (and most languages), iterators into vectors are (ptr, end)
pairs. Having a notion of "parent" objects allows us to make them plain ptr
values, and additionally allows for safely appending to vectors while iterating.
Some background first. In Rust, iterators into vectors (technically, into slices) are internally represented as (ptr, end)
pairs. Thus if we create an iterator,
let mut i = vec.iter();