From: Will Sobel Date: 2001-06-27T10:04:56+09:00 Subject: [ruby-talk:16941] Another question This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0FEA6.26979B30 Content-Type: text/plain; charset="iso-8859-1" Thanks a lot for getting back to me so fast on my last question. I have been trying to get John W. Small's version of DBI (version 0.1) to work. I have found another problem in both 1.6.3 and 1.7.1 that is present in the dbi.rb module. When you run the attached code as follows you get an exception with -d and without -d it silently ignores the define_finalizer call: % ruby t.rb finalizing2 % ruby -d t.rb Exception `NotImplementedError' at bug.rb:3 - method call on terminated object finalizing2 % The question--can you define a finalizer on self in the initialize method as they do in DBI or is this illegal? Thanks in advance, Will ---BEGIN-CODE--- class Test def initialize ObjectSpace.define_finalizer(self, Proc.new{ puts "finalizing" }) end end t = Test.new ObjectSpace.define_finalizer(t, Proc.new{ puts "finalizing2" }) t = nil GC.start ---END-CODE--- ------_=_NextPart_001_01C0FEA6.26979B30 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Another question

Thanks a lot for getting back to me so = fast on my last question. I have been trying to get John W. Small's = version of DBI (version 0.1) to work. I have found another problem in = both 1.6.3 and 1.7.1 that is present in the dbi.rb module. When you run = the attached code as follows you get an exception with -d and without = -d it silently ignores the define_finalizer call:

% ruby t.rb
finalizing2
% ruby -d t.rb
Exception `NotImplementedError' at = bug.rb:3 - method call on terminated object
finalizing2
%

The question--can you define a = finalizer on self in the initialize method as they do in DBI or is this = illegal?

Thanks in advance,
Will


---BEGIN-CODE---
class Test
        def initialize
        =         ObjectSpace.define_finalizer(self, Proc.new{ puts = "finalizing" })
        end
end

t =3D Test.new
ObjectSpace.define_finalizer(t, = Proc.new{ puts "finalizing2" })
t  =3D nil

GC.start
---END-CODE---

------_=_NextPart_001_01C0FEA6.26979B30--