From: Adam Shelly Date: 2006-03-03T04:55:13+09:00 Subject: Re: Mutual require problem On 3/2/06, renaud delbru wrote: > Hi, > > I have a problem with the require method. > > First file 'main.rb': > > > > require 'test' > > > > class A > > def self.print > > p "test" > > end > > end > > > > Test.print > > Second file 'test.rb': > > > require 'main' > > > > class Test < A > > end > > And the result during the execution : > workspace/test-divers/main.rb:10: uninitialized constant Test > (NameError) > Circular requires are a bad thing. See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/178329. To avoid them, try the ruby equivalent of a forward declaration: In test.rb, replace > require 'main' with > class A; end -Adam