3 ms·
That looks interesting. Looks a lot like the C++ Standard Guidelines lifetime proposal. But it doesn't seem to consider invalidation of references via mutation.
by roca 10y ago
That looks interesting. Looks a lot like the C++ Standard Guidelines lifetime proposal. But it doesn't seem to consider invalidation of references via mutation. For example, could you write a growable array implementation that returns references to its elements, but ensure that those references are not allowed to persist across operations that grow (and hence reallocate) the array? Rust can do this, but I don't think you'll be able to unless you introduce a distinction between mutable and immutable references and integrate it into your safety analysis.