>>>>> "David" == David Bolen <db3l / fitlinxx.com> writes:
David> I'm curious, in the "better" case, does Ruby actually
David> ensure that the file will be closed down at the OS level
David> when the block exits?
Yes. The block version of open actually calls close from an ensure
block to make sure the file is closed when the block is finished.
This is the big advantage to using the block form. It does not wait
for the garbage collector and finializer.
--
-- Jim Weirich jweirich / one.net http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)