More radical ideas about gc and reference counting

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Wed May 14 04:27:40 PDT 2014


Walter Bright:

> On 5/12/2014 10:25 AM, bearophile wrote:
>> Walter Bright:
>>
>>> Unions of pointers are so rare in actual code that treating 
>>> them
>>> conservatively is not a big problem.
>>
>> std.variant.Algebraic is based on on std.variant.VariantN, and 
>> on
>> std.variant.VariantN is based on an union, and often you use 
>> algebraic data
>> types to represent trees and similar data structures that 
>> contain many
>> references/pointers. Adding Adding an onGC() method to 
>> std.variant.VariantN you
>> allow the GC to manage Algebraic well enough.
>
> BTW, the RTinfo can be used to discriminate unions.

Do I have to open a Bugzilla entry asking for VariantN to use 
such RTinfo to allow a more precise tracing of pointer-heavy 
Algebraics? Suggestions are welcome.

Bye,
bearophile


More information about the Digitalmars-d mailing list