Fritz Heinrichmeyer <fritz.heinrichmeyer / fernuni-hagen.de> writes: [... regarding behavior of finalizers under reference counting and GC ...] Dave> I think that may have been the case. Dave> However, often the situation doesn't really arise in Ruby, Dave> as blocks are used for these kind of purposes. I've Dave> personally switched over to a style where 99% of resource Dave> management is done using blocks, and it really does make Dave> life simpler: Dave> DB.connect(name, pw) do |db| Dave> # .. do lots of database stuff Dave> end In fact, support for block centric resource management was explicitly added to the (otherwise Perl-like) Ruby DBI interface. DBI.connect("DBI:Pg:testdatabase") do |db| db.transaction do db.prepare ("UPDATE ...") do |st| st.execute(...) end # st.finish automatically called db.execute("SELECT ...") do |st| st.each { |row| # Process Row } end # st.finnish automatically called end # db.commit automatically called end # db.disconnect automatically called If you wish, the Perl-like interface where values are explicitly returned and managed is still available. e.g. db = DBI.connect("DBI:Pg:testdatabase") ... db.disconnect -- -- Jim Weirich