Re: Tempfile strangeness in 1.9.0

From: Steven Jenkins <steven.jenkins@...>
Date: 2004-04-24 15:52:15 UTC
List: ruby-core #2816
Yukihiro Matsumoto wrote:
> Tempfile is a duck quacks like an IO, so that adding a method to the
> IO class does not always reflect to the Tempfile class.  1.6 tempfile
> delegates every method to the IO at run time; 1.9 tempfile defines
> delegation statically to gain performance.

Sorry, my message wasn't clear. I read in the Pickaxe about Tempfile and 
delegation, and I figured that 1.9 was more restrictive than 1.8.

What I didn't understand is why

f = Tempfile.new('test')
f.a
f.close

raises NoMethodError, but

Tempfile.new('test') do |f|
     f.a
end

does not. The answer, of course, is that Tempfile.new() does not take a 
block. Sorry about the confusion.

Steve

In This Thread