From: Robert Klemme Date: 2007-06-11T17:20:25+09:00 Subject: Re: Prettier solution to circular dependency On 11.06.2007 08:39, Daniel DeLorme wrote: > Helder Ribeiro wrote: >> This is an aesthetic problem: I have a method in a module, and I want >> to include it in three different classes (they're all in the same >> file). This method refers itself to one of those classes. So i have to >> include the module into the classes, but for the method to be parsed, >> one of those classes needs to be already defined. > > You're still thinking in terms of static typing. In this case you > *don't* have a circular dependency. You can load ElementFactory first > and it doesn't matter if Element is not yet defined, as long as you > don't invoke the method 'element_factory' Having said that I'd still consider the cyclic dependency (on the logical level) bad design. We do not know more about those classes but my impression is that this can probably improved upon. Kind regards robert