From: Charles O Nutter Date: 2006-07-30T15:31:27+09:00 Subject: Inconsistency in scoping during module_eval? ------=_Part_9756_3668350.1154241084890 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I have the following code: class Foo end Foo.module_eval {|| def bar end BAZ = 1 } p defined?(bar) => nil p defined?(BAZ) => "constant" p defined?(Foo::BAZ) => "constant" Why is it that bar is correctly defined under the class Foo, but BAZ gets defined at the top level? Is there a reason for this inconsistency? -- Contribute to RubySpec! @ www.headius.com/rubyspec Charles Oliver Nutter @ headius.blogspot.com Ruby User @ ruby.mn JRuby Developer @ www.jruby.org Application Architect @ www.ventera.com ------=_Part_9756_3668350.1154241084890--