On Wed, 10 Mar 2004 15:23:08 +0100, shasckaw wrote:
> Simon Strandgaard wrote:
>> Is this a bug?
>> Shouldn't 'require' load both modules in this case?
>> If not, what is the motivation for doing so?
>> 
>> Just curious :-)
>> 
>> --
>> Simon Strandgaard
> [snip]
>> require 'mod'
>> $:.unshift('dir')
>> require 'mod'
>> server> ruby a.rb
>> hello1
>> server> ls 
>> a.rb    dir/    mod.rb
>> server>
>> 
>> I would have expected it to output both 'hello1' and 'hello2'.
> 
> Hello Simon!
> 
> When requiring a module twice, it is probable that ruby just use its 
> name to check if it has to reload it or not, forgetting to also check if 
> it is in a different directory or not.

It seems so.

 
> You can do this instead:
> require 'mod'
> require 'dir/mod'
> 

I'm already aware of that ;-)

--
Simon Strandgaard