From: Charles Oliver Nutter Date: 2008-12-23T02:14:52+09:00 Subject: [ruby-core:20798] Re: use of require thread safety Paul Brannan wrote: > On Mon, Dec 22, 2008 at 03:05:07AM +0900, Charles Oliver Nutter wrote: >> Two threads requiring the separate files at the same time will deadlock. >> Of course this is contrived, but there are circular requires fairly >> often in applications. > > What applications use circular requires? > > I don't think circular dependencies are a good idea in general, though > Ruby shouldn't break if someone tries. It's not so much that they intend to be circular; more it's that many files re-require all resources they expect to need, which over time can result in circular dependencies (if every script requires everything it things it needs, it's almost assured a few of those will have reverse dependencies back). file_one.rb require 'file_two' require 'file_three' require 'file_four' module Foo .... file_three.rb # I know I need file_one to be loaded so module Foo is available... require 'file_one' class Blah; include Foo ... - Charlie