Is there a weak pointer or references in D?

thedeemon dlang at thedeemon.com
Sun Jan 13 05:21:25 PST 2013


On Saturday, 12 January 2013 at 11:27:03 UTC, Era Scarecrow wrote:
> On Saturday, 12 January 2013 at 10:58:23 UTC, thedeemon wrote:
>> So the runtime is aware of weak pointers and clears them to 
>> "empty" state when pointed value dies. I don't see yet how it 
>> can be implemented in D without patching its GC.
>
>  There's that, but also what about what if the pointer wasn't a 
> pointer to the data at all?

In OCaml, which I was talking about, GC is precise, so there are 
no false pointers. This is done by tagging: pointers have least 
significant bit being 0 and non-pointers all have it 1, so native 
ints in OCaml are one bit smaller than usual (31-bit on x86).




More information about the Digitalmars-d-learn mailing list