More radical ideas about gc and reference counting

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon May 12 10:44:44 PDT 2014


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.



More information about the Digitalmars-d mailing list