Hi,

In message "Re: Scope of constants in instance_eval"
    on Mon, 27 Feb 2006 02:23:34 +0900, "Phrogz" <gavin / refinery.com> writes:

|class Foo
|  BAR = 1
|  def initialize( &block )
|    instance_eval &block
|  end
|  def bork
|    puts "bork: self is #{self}"
|    puts "bork: BAR is #{BAR}!"
|  end
|end
|
|Foo.new{
|  bork
|  puts "block: self is #{self}"
|  puts "block: BAR is #{BAR}!"
|}
|
|#=> bork: self is #<Foo:0x32c808>
|#=> bork: BAR is 1!
|#=> block: self is #<Foo:0x32c808>
|#=> NameError: uninitialized constant BAR

In 1.8, constant uses lexical look-up, even within the block given to
instance_eval().  We changed this behavior in 1.9 to simplify things.

							matz.