Hi -- On Sat, 4 Aug 2007, Kenneth McDonald wrote: > Simple example that doesn't work: > > ---------------- > module Test > p "Testing" > eval("def foo\np 'OK'\nend") > foo > end > ---------------- > > 'foo' does not get defined in a place where it can be found by the call on > foo, and I get an error. However, when I execute the two lines > > eval("def foo\np 'OK'\nend") > foo > > in IRB, everything works. I'm guessing that this is a namespace problem, but > can't see why it would be. Then again, I'm accustomed to the Python namespace > model, and still don't understand all of the ways in which the Ruby model is > different. Your first example is essentially doing this: module Test def foo p "OK" end foo end When you define an instance method inside a module, you're defining it for the future use of objects with that module in their ancestry: class C include Test end C.new.foo # OK David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)