From: Calamitas Date: 2008-07-24T21:19:32+09:00 Subject: Re: circular 'require' On Thu, Jul 24, 2008 at 10:02 AM, Shadowfirebird wrote: > 1) require is mildly broken (a). It doesn't set $" until after the > given file is loaded. This can lead to errors when you have a > circular call of requires. If it set $" first, circular references > would just be ignored. Of course, you should never actually *need* to > have circular 'require' referefences, but: see my next point. Require isn't broken. Essentially, you could say that require has its internal version of $" that is set before executing a file (although as Stefano pointed out, it is maintained as the difference with the externally visible $"). Require works as advertised. But "ruby test1.rb" doesn't do a require of test1.rb, "ruby -r test1.rb" does that. "ruby test1.rb" simply executes the file without looking at or setting $", which is what #load does too. This is by design. If you explicitly set $" in test1.rb, you essentially give a load of that file some of the semantics of a require. Peter