Better branding of -betterC
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Fri Oct 30 14:37:09 UTC 2020
On Friday, 30 October 2020 at 14:24:43 UTC, Steven Schveighoffer
wrote:
> I think D was looking at one point to be able to do this, but
> via a specialized library hook.
>
> The difference between RC and a tracing GC is that cycles can
> prevent garbage from being detected in RC, whereas tracing can
> find those.
>
> Even in swift, you have a notion of weak references that get
> auto-nullified when the target gets destroyed, and not properly
> setting up an ownership relationship will result in items not
> being collected. But certainly it's much easier than the
> Objective-C requirements.
*nods* Yes, you need weak references. I did like your idea of
having reference counting and using the current GC-collection
infrastructure for detecting cycles and dangling pointers. I
think dynamic sanitizers can be very powerful.
Class objects are already quite heavy as each interface adds
another pointer to each object, so I don't think adding two
counters would make a catastrophic difference.
I once made a prototype refcounting scheme in D with borrowing
that tracked the number of borrows at runtime. You could even add
tracking of __FILE__ and __LINE__ and get good debug tracking
during testing.
So there are interesting possibilities without "throwing out
everything". E.g. retaining key properties of the tracing GC for
development and drop down to ARC at release.
More information about the Digitalmars-d
mailing list