The easiest way to compete with Rust and cure D's GC reputation: switch to ARC.
Luna
luna at foxgirls.gay
Mon Jul 14 20:30:28 UTC 2025
On Saturday, 12 July 2025 at 21:36:18 UTC, Dukc wrote:
> On Friday, 11 July 2025 at 20:18:59 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>> As a topic supporting ARC style memory management has long
>> since been discussed. This isn't a new idea.
>>
>> For ARC at the language level to exist, it requires that all
>> memory in D would have to have a predictable state access. For
>> example with a slice, not only do you need a pointer, length,
>> but also the state object.
>
> Well not quite.
>
> The reference count for ARC allocations would presumably exist
> in the runtime registry, not in the allocated object itself.
> Just like runtime type information does for garbage collected
> allocations.
>
> 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.
RTTI doesn’t exist in the runtime per-say. That is generated by
the compiler for every type at compile time and the first entry
of the vtable of a class stores a reference to the RTTI.
I think RTTI TypeInfo and ModuleInfo classes are the only real
classes in D that are const/read-only instantiated?
More information about the dip.ideas
mailing list