Allocator-aware @safe reference counting is still not possible
Paul Backus
snarwin at gmail.com
Mon Jan 23 16:39:31 UTC 2023
On Monday, 23 January 2023 at 08:49:50 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> Basically right now we're missing the lifetime checks
> surrounding borrowed & function parameter. Everything else is
> do-able right now, even if it isn't as cheap as it could be
> (like RC eliding).
Have you seen the borrow method [1] used by SafeRefCounted? It is
already possible, in the current D language, to prevent a
container or smart pointer from leaking references. The syntax is
awkward, because you have to use a callback, but it can be done.
Lifetime issues are not the blocker here. The blocker is being
able to give deallocate/free a safe interface, so that it can be
used safely in a generic or polymorphic context, where the
specific implementation is not known in advance.
[1]: https://dlang.org/library/std/typecons/borrow.html
More information about the Digitalmars-d
mailing list