dasch wrote:
> Yeah, it's me again, your friendly neighbourhood power-suggester!
> 
> I'm wondering why there isn't a `finalize' method classes can define,
> that will be called immediately before instances of that class are
> garbage collected? I'm aware of ObjectSpace.define_finalizer, but it
> seems un-OO, and it doesn't seem to work when being called from within
> the instance methods. It also seems as if the Proc sent to
> `define_finalizer' isn't called until *after* the object has been 
> destroyed.

That's correct, it prevents problems like the following code:

  class Klass
    def finalize
      $global_reference = self
    end
  end

-- 
Posted via http://www.ruby-forum.com/.