Bug #1322: define_method scope bug
http://redmine.ruby-lang.org/issues/show/1322

Author: coderrr .
Status: Open, Priority: Normal
Category: core
ruby -v: ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]

a = 1  
 Object.send :define_method, :x do  
   lambda do
     p a
     a = 2  
     p a
   end.call  
 end  
 x(nil)
 p a

output is 1,2,1 instead of 1,2,2

details and possible fix:  http://coderrr.wordpress.com/2009/03/29/ruby-18-define_method-scope-bug/


----------------------------------------
http://redmine.ruby-lang.org