Future of SafeRefCounted

Dennis dkorpel at gmail.com
Sun Feb 23 20:02:03 UTC 2025


On Saturday, 22 February 2025 at 19:05:49 UTC, Dukc wrote:
> This sounded obviously a good idea back then, so the destructor 
> of
> SafeRefCounted has a `static if` that checks for DIP1000 and
> does the deallocation inside a `@trusted` lambda if the switch
> is enabled, directly otherwise.
> (...)
> What are your thoughts?

To me it always looked hacky, and I'd get rid of it as well.

On the other hand, I think reference counting sucks in general, 
and see little value in using it in Phobos. Especially in 
functions like dirEntires, as if that is going to be called a lot 
in performance critical real-time code.

If you want to get rid of the GC dependency, you can use arena 
allocation. ([I talked about this last 
DConf](https://dconf.org/2024/index.html#dennisk))



More information about the Digitalmars-d mailing list