Well, it is not so simple. Currently we check whether the file is already in
$". But it doesn''t get into the list until it''s execution
is successfully finished:
x.rb:
p $"
require ''y.rb''
p $"
y.rb:
p $"
The output is:
[]
[]
["y.rb"]
So we probably need another list/table of already loaded files. Besides, a
single file could be required multiple times - if you do $".clear before
calling require. I need to figure out what is exactly the condition under which
Ruby doesn''t load a file. Could you please file a bug?
Tomas
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at
rubyforge.org] On Behalf Of Wayne Kelly
Sent: Tuesday, May 13, 2008 10:23 PM
To: ironruby-core at rubyforge.org
Subject: [Ironruby-core] require infinite loop
With the latest version, if a ruby source file requires itself, or if there is a
cyclic chain of requires so that the original source file is required again - it
results in an infinite loop.
This used to work correctly in the previous version - it simply requires marking
the file as already loaded prior to executing it.
Cheers, Wayne.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/ironruby-core/attachments/20080513/cef5e4fd/attachment.html>