unique ownership + unlimited safe generational references
Nick Treleaven
nick at geany.org
Tue Mar 29 18:54:55 UTC 2022
On Tuesday, 29 March 2022 at 17:40:27 UTC, IGotD- wrote:
> In general I think that unique ownership of pointers is a
> plague in computer science and it needs to die. The reason is
> that it is fundamentally data structure unfriendly.
Vale has unique ownership of objects, the references/pointers
aren't owned. But I think you could have shared ownership of
objects and still benefit from generational references. Maybe GR
are like weak references, except (hopefully) more efficient.
(Based on a cursory google of weak references in C++ and Swift,
it seems they require an extra allocation per-object for the
counter).
> When it comes to the memory management described here
> (Generational References), it is like a runtime version of the
> borrow checker in Rust (not completely, but close). It solves
> use after free but what does it solve beyond that?
Memory-safety without GC is a big thing.
> Also, does need to do a check for every deference?
I suppose it would need to re-check if any code/function call was
made in between dereferences that could have destroyed the owner.
More information about the Digitalmars-d
mailing list