John Ky wrote:
> Why doesn't ruby detect that tmp isn't used in the block and not keep a
> reference to it?

Because tmp can still be accessed using the block even if it's not used in the 
block directly:
def foo()
  x = 5
  lambda {puts "Hello world"}
end
hello_world_block = foo
eval("x", hello_world_block) #=> 5

HTH,
Sebastian
-- 
Jabber: sepp2k / jabber.org
ICQ: 205544826