Erik Veenstra wrote:
> Consider...
> 
>  File.new("file.ext", "w").write data

I don't think it can be collected during the #write method, because the 
File object is the value of "self" during the method. It's reachable, so 
it shouldn't be collected.

Still, there are good reasons to use the block form, as others have 
pointed out.

> Is this safe? When will the file be closed? For IO it's said:
> "I/O streams are automatically closed when they are claimed by
> the garbage collector." Is this true for files as well, (File
> is a subclass of IO)?