And the result during the execution :
workspace/test-divers/main.rb:10: uninitialized constant Test
(NameError)
It's a simple example to show you the problem, but in a more complex
program, I have the same problem.
I think I understand what happen,
ruby begin to load main.rb, see the require 'test',
try to load test.rb, see the require 'main',
try to load main.rb with success, but when he arrived to
Test.print, ruby doesn't finish to load 'test.rb' and Test
become a uninitialized constant.
Another useful technique here is autoloading.
There are cases where require is needed, but in general autoload is much
better.
Looser coupling, less memory use, faster programs.
Cheers,
Han Holl
···
On 3/3/06, Guest <renaud.delbru@deri.org> wrote:
Thank you adam for your answers,
I have resolved the problem with a toplevel file which contains
the sequence of require.