The easiest way to compete with Rust and cure D's GC reputation: switch to ARC.

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat Jul 12 23:32:59 UTC 2025


On 13/07/2025 11:20 AM, Dom DiSc wrote:
> On Saturday, 12 July 2025 at 21:36:18 UTC, Dukc wrote:
>> Storing the ref count along the object would likely perform better, 
>> but don't think it would be done like that in D because the same 
>> reference types are used to deal with objects allocated in C.
> 
> And a RefCounter separate of the object is necessary for const objects 
> (as it need to remain mutable).

Mutability in language doesn't matter for this kind of thing.

For internal details like this you can break const, immutable and 
shared, they are a preventative measure for the human, not for the runtime.

What matters is if something is in read only memory, as long as you 
consider such memory as having an infinite lifetime then it is ok. 
Remove RC state and it won't effect anything.

This comes up for classes, they can't be in ROM due to the monitor 
needing to be mutable. If it could be nullified out, then it wouldn't be 
an issue.


More information about the dip.ideas mailing list