On Sep 25, 2005, at 6:45 AM, TRANS wrote:

> On 9/25/05, Ryan Davis <ryand-ruby / zenspider.com> wrote:
>
>> I don't think it is an ignorable issue, no... I think the issue
>> itself, circular dependencies--especially across modules--is a very
>> strong indicator of bad design. Further, I don't think it is ruby's
>> job to help make this work and/or smell any better. In fact, the less
>> it does to help, the better.
>
> Thanks, I understand your concern. Yet mutual dependencies are
> different from circular dependencies. With the former it's frequently
> just the case that if one lib is required the other ought to be
> available as well. For instance somthing as simple as two Nano methods
> I have: starts_with.rb and ends_with.rb. If one's loaded I want the
> other loaded as well --they don't actually depend on each other to do
> anything.

Mutual dependencies are only different from circular dependencies if  
there are no cycles amongst the transitive closure of the dependency  
graph. Without a DAG, you are bound to have cycles. Specifically,  
mutual dependencies are NOT different from circular dependencies in  
YOUR case:

> in t1.rb
>
>   require 't2.rb'
>   p "HERE1"
>
> in t2.rb
>
>   require 't1.rb'
>   p "HERE2"

That is a circular dependency. Plain and simple. It doesn't matter if  
you prefer to call it a "mutual" dependency because "they don't  
actually depend on each other to do anything"... except that  
"require" line of course. That require line is a "do" and "require"  
=== "depend".

I think the key word in your paragraph above is "want" and reeks of  
bad design smell.