From: Shadowfirebird Date: 2008-07-23T19:44:30+09:00 Subject: Re: circular 'require' Thanks for the explanation, but this does rather worry me. It seems to be a limitation without documentation or good reason. No doubt it makes sense to those of you with more experience or Ruby and OOP in general... As to why I want to create files with circular references? That's a perfectly good question (but, I think, a seperate one). Principal-of-least-astonishment answer: I don't wish to be contentious, but why should I not? There is nothing in the pickaxe or the API docs that says this should be avoided. And it's not unreasonable for my objects to talk to each other in a fairly complex way. My program worked fine when it was a single file. Technical answer: I have a bunch of classes that all inherit, directly or indirectly, from a root class. The root class stores an array of all objects created in a class variable. It also has some static methods so that the child classes can get information from that array; some of these classes use kind_of?() to tell different objects apart. So the child classes call static methods in the root class, and these static methods in turn refer to the child classes. Whether this is good design or not is open to question. I'd be very interested in suggestions for alternative approaches. But, as I say, I think that's a seperate question. Can anyone tell me why require isn't coded to cope with circular references, since it appears to be a relatively simple problem to solve?