[Ruby] ObjectSpace.define_finalizer в конструкторе
Yuri Leikind
YuriLeikind at scnsoft.com
Tue Nov 12 14:10:50 MSK 2002
Привет,
Кто-нибудь просветит меня, почему finalizer не
присобачивается в конструкторе?
Смотрите:
class Test
def initialize
ObjectSpace.define_finalizer( self, lambda{ puts "removing 1" } )
end
end
a = Test.new
ObjectSpace.define_finalizer( a , lambda{ puts " -- removing 2" } )
Этот скриптец работает так:
leikind at leikind,/var/www/dict $ ruby test.rb
-- removing 2
Best regards,
Yuri Leikind
___
Nothing shortens a journey so pleasantly as an account of misfortunes at
which the hearer is permitted to laugh.
-- Quentin Crisp
More information about the Ruby
mailing list