From: David Flanagan Date: 2007-09-14T05:25:15+09:00 Subject: Wrapped loads and Module::nesting When I call load with a second argument of true, the file is loaded into an anonymous module. In Ruby 1.8 I can use Module::nesting[0] to obtain this anonymous module. It no longer works in Ruby 1.9. I think Ruby 1.9 ought to work like 1.8 because then a wrapped module can pass itself back to the loader with code like this: # This code is in the file to be loaded wrapped if Module.nesting.size > 0 # If we're loaded into a wrapper module $wrapper = Module.nesting[0] # Pass the module back to the loader end module Foo class Bar def b "Foo::Bar.b" end end end # This code is the file that does the wrapped load: # Use include to safely allow the wrapped file to define new modules # without modifying existing ones load "wrapmod.rb", true include $wrapper if $wrapper puts Foo::Bar.new.b Doing something like this is the only way that using wrapped loads makes sense to me. If we can't do this in 1.9 then wrapped loads no longer seem useful. Are there security implications I'm missing here? David