radical ideas about GC and ARC : need to be time driven?

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Thu May 15 00:27:39 PDT 2014


On Wednesday, 14 May 2014 at 09:39:01 UTC, Marc Schütz wrote:
> RC is done by the object itself, so by definition it knows its 
> own type, while the GC needs to be told about the type on 
> allocation. AFAIK there is ongoing work to make this 
> information available for non-class types.

If you can unify RC on binary level for any type, GC can use that 
unification too: when you allocate the object, you has its type 
and can setup necessary structures needed to call the destructor.

> Well, it cannot be made 100% reliable by principle. That's just 
> an inherent property of tracing GCs. The question is, can we 
> define which uses of destructors are "safe" in this sense and 
> which ones are not, and ideally find ways to detect unsafe uses 
> at compile time... That's very much in the spirit of D: 
> Something that looks right, should be right. If it is not, it 
> should be rejected by the compiler.

Does this suggest that if you slip a type with destructor into 
your code, it will force everything to be refcounted?


More information about the Digitalmars-d mailing list