Why do we have transitive const, again?
bearophile
bearophileHUGS at lycos.com
Sun Sep 25 08:12:10 PDT 2011
Timon Gehr:
> I think it should be a language feature, as proposed by Jonathan.
I did miss his post. I see he has turn that idiom into a language feature :-)
>From Jonathan's post:
> 2. __varLoaded is default-initialized to false, and __var is void (so, garbage).
The GC has to read __varLoaded and then scan the contents of __var only if __varLoaded is true.
To do this in user code (or code rewritten by front-end rules) time ago I have suggested to add this simple standard method to D:
bool onGC(string fieldName)() {...}
That if present is called by the GC during its scan, to know if a union/struct/clas method needs to be scanned now (I did invent it for unions, but it's useful for structs too, it seems).
Bye,
bearophile
More information about the Digitalmars-d
mailing list