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.

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: [email protected]
[mailto:[email protected]] On Behalf Of Wayne K.
Sent: Tuesday, May 13, 2008 10:23 PM
To: [email protected]
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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs