The easiest way to compete with Rust and cure D's GC reputation: switch to ARC.
Dukc
ajieskola at gmail.com
Thu Jul 10 19:01:07 UTC 2025
On Wednesday, 9 July 2025 at 17:10:26 UTC, WraithGlade wrote:
> In particular, it seems to me that by far the easiest way to
> cure D of its GC-dependent reputation (which is one of the
> biggest reasons why people avoid using D) is to switch the
> whole standard language and library to use ARC based memory
> management instead.
I don't think this is a good idea.
Because ARC suffers from the cyclic reference leaks that would
have to be manually worked around, it'd mean that D programs
would more or less have to be designed like Rust programs. With a
tracing GC, we can almost always allocate in fire-and-forget
style. While that'd still be the case most of the time with ARC,
it is going to happen that we accidentally cause memory leaks
with circular references, and then spend a lot of time figuring
out the problem and then designing around it.
Second, it means all pointer assignments will have to be
write-gated, to increment and decrement the reference counter.
Not a big issue for most programs, but a minus nonetheless.
If it was just about the second issue, it might well be still
worth it. Likewise, if the GC was mandatory and therefore made
the most demanding real-time programming impossible, but it
isn't. Considering how rarely you have to go totally without the
GC, I think the first issue is far bigger a problem than the
unpredictability of the tracing GC.
Then again, the last time I heard from Ali Weka.IO doesn't use
the GC at all in their superperforming filesystem. Maybe they
disagree with my assesment and if they do, I might well change my
mind.
More information about the dip.ideas
mailing list