From: botp Date: 2009-04-16T12:57:35+09:00 Subject: Re: Instance_eval and constants lookup rules in ruby 1.9 On Thu, Apr 16, 2009 at 12:13 AM, Daniel Mendler wrote: i should expect that behaviour if using *instance*_eval inside *modules*. i have many options though (note test2.rb does not use instance_eval)... botp@jedi-hopeful:~$ cat test?.rb #--test1.rb------------ class X def run(&block) instance_eval(&block) end end module A I_AM_FOUND = 666 a = X.new a.run { puts A::I_AM_FOUND } end #-- test2.rb --------- class X def run(&block) block.call end end module A I_AM_FOUND = 666 a = X.new a.run { puts I_AM_FOUND } end #-- test3.rb ----------- class X I_AM_FOUND = 666 def run(&block) instance_eval(&block) end end module A a = X.new a.run { puts I_AM_FOUND } end #-- test4.rb ----------- class X def run(&block) instance_eval(&block) end end I_AM_FOUND = 666 a = X.new a.run { puts I_AM_FOUND } botp@jedi-hopeful:~$ kind regards -botp