From: Nasir Khan Date: 2007-04-17T15:23:28+09:00 Subject: Re: load behavior IMHO it is definitely not a bug as Kernel.require would just load the library at the top level as there is no wrap=false equivalent in require, further the doc says "The name of the loaded feature is added to the array in $" " So there is no ambiguity in what it does here. Kernel.load with wrap=true again does what it says in the doc "loaded script will be executed under an anonymous module" which is equivalent to - mod = Module.new mod.module_eval("require '2.rb'; X=1") => true D => bar X => NameError: uninitialized constant X Which brings back to require behavior. Now you could argue that this may appear to be un-intuitive, but that's a different issue. - Nasir On 4/16/07, John Lam (CLR) wrote: > > > > > Consider this code: > > > > load('1.rb', true) > > puts C # error expected > > puts D # expecting this to be an error as well > > > > 1.rb: > > > > C = "foo" > > require '2.rb" > > > > 2.rb: > > > > D = "bar" > > > > Is this a bug (we're using 1.8.5)? > > > > From the docs: "If the optional wrap parameter is true, then the loaded script will be executed under an anonymous module, protecting the calling program's global namespace." > > > > Secondary question, should require '2.rb' respect the true flag from the original load()? > > > > Thanks, > > -John > >