On Thu, 18 Jan 2007 paul.denize / datacom.co.nz wrote:

> I have Ruby 182-15 on WinXP
>
> When I run the code below only the first finalizer runs.  The others
> two don't seem to run.  I found similar posts on other sites, but no
> solutions.
>
> You can duplicate the first and it runs twice (so two finalizers is
> ok).
>
> To me they are all somewhat identical.  Can anyone tell me why it does
> not work.

finalizers cannot refer the to object being finalized.  in the second and
third cases you hold a reference to the object (implicit in Proc.new/proc)
inside the created closures - thereby preventing them from being run.
inotherwords you've created finalizers that prevent the object from being
finalized!  ;-)

-a
-- 
in the practice of tolerance, one's enemy is the best teacher.
- the dalai lama