[Newbies] What is a "weak" reference
r.j.rothwell at gmail.com
Mon Jul 14 16:51:39 UTC 2008
On Mon, Jul 14, 2008 at 11:42 AM, Todd Blanchard <tblanchard at mac.com> wrote:
> So how do you make a weak reference? You stick a WeakArray in as a holder.
> So in your parent/child objects you would write something like:
> ^ parent ifNotNil: [parent first] ifNil: [parent]
> Node>>parent: p
> parent := p ifNotNil: [WeakArray with: p] ifNil: [p]
> thus using a WeakArray as a holder for the parent.
> When a weak reference gets garbage collected, its weak references are set
> to nil first.
Thank you! This is what I wanted to know; I'll give this a try, and see how
it works for me...
So many Classes, so little time...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners