Allocator-aware @safe reference counting is still not possible

jmh530 john.michael.hall at gmail.com
Mon Sep 26 12:23:43 UTC 2022


On Sunday, 25 September 2022 at 12:03:08 UTC, Paul Backus wrote:
> [snip]
> The only solution is to somehow allow `deallocate` (and by 
> extension `free`) to have a `@safe` interface on its own—which 
> isn't possible in the current D language. At minimum, it would 
> require something like an [`isolated` qualifier][3] (h/t 
> deadalnix for the link), which would guarantee that a pointer 
> is the only pointer to a particular block of memory. Some form 
> of ownership/borrow checking would also work, of course.
> [snip]

It makes sense to me, though I'm not an expert. Another way to 
think about it is some way to incorporate ownership into the type 
system.

Walter hasn't been convinced yet that @live isn't sufficient. I 
think this would need to be proven to his satisfaction before he 
starts considering alternative. Maybe it can't hurt to flesh this 
argument out further?

Nevertheless, I think being able to do allocator-aware @safe 
reference counting should be a necessary condition before moving 
to @safe by default.


More information about the Digitalmars-d mailing list