Weak references.

Michel Fortin michel.fortin at michelf.com
Sun Apr 13 04:45:54 PDT 2008


On 2008-04-12 17:24:44 -0400, "Jarrett Billingsley" <kb3ctd2 at yahoo.com> said:

> Is this possible at all?  Am I just not using Bill's weakref properly?

I've been using an alternate strategy in the D/Objective-C bridge for 
the bridged object lookup table. Basically, I'm casting object 
references to size_t (so they're no longer pointers) and mangling the 
pointers (so the garbage collector can't see them as pointers, I think 
this is no longer be necessary). When the bridged object gets deleted 
on the D side, it removes its mangled pointer from the table.

So if your referenced object knows about its weak reference in the 
table, you could implement it as such and don't have to worry about 
null pointers polluting your table.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list