Lloyd Zusman schrieb:
> Suppose I have a file named 'modtest' which contains the following two
> lines:
> 
>   X = 1
>   Y = 2
> 
> Then, I execute this ruby code:
> 
>   mod = Module.new {
>     load('modtest')
>   }
>   p mod.constants
> 
> When this code runs, I see this:  []
> 
> In other words, it's an empty array, which means that I'm not seeing the
> constants X and Y.

In addition to what Joel already said, note that

   mod = Module.new {
     load('modtest')
   }

is the same as

   mod = Module.new
   load('modtest')

Kernel#load doesn't load the code in the context where it is called, but in the 
context of the toplevel object (main) or in the context of an anonymous module, 
if you set the second parameter to true. You can test this if you put a "p self" 
into the file modtest.rb.

Regards,
Pit