> -----Original Message-----
> From: dave / thomases.com [mailto:dave / thomases.com]On Behalf Of Dave
...
> Just to back up what Kevin says: Mixins are also not just passive.
> They can alter the class that includes them (which is half way to
> Aspect Oriented Programming). For example, the Singleton mixin

I agree with you that Ruby facilitates AOP techniques (note that
I have a faintes clue what AOP programming is about) but the
Singleton module is a bit of a cheat. The author overrode the 
usual behavior of #append_features (this method is called when
the ruby interpreter sees ``include OtherModule'') and did not
even bother to call super.append_features - the net effect:

require 'singleton'
class A
include Singleton
end
p A.ancestors # no Singleton module in sight

Even worse when you try to include the module Singleton into 
another module  (something you can do with a normal module) and 
not a class (a special kind of module) the interpreter rightfully
complains. It would have been conceptually more honest to add a 
make_singleton method to the Class (note the capitalization) 
interface or define this - appropriately - as a singleton method
of Singleton - to be called along the lines of 

class A
Singleton.follow_me(A) # just kidding
end

Seriously, if someone wants to write a AOP package please think
twice before overriding  #append_features - if it does not make
sense for modules don't do it. And since I am at it - are there
any plans to deal with the circular mix-in (which will probably 
bite gulp at some point) problem?


module L1
end
module L2
end
module L3
end
module L4
end
module L5
end

module L4 
include L3 
include L1
include L2
end

module L3
include L4
include L1
include L4
include L5
end

module L2
include L1
include L4
include L3
end

module L1
include L2
include L4
include L5
end

module L3
include L2
end

module L1
include L3
end

module L5
include L3
include L1
include L2
end

module L2
include L5
end

module L4 
include L5
end

module L5
include L4
end


# and now the grand finale
p  L1.ancestors
p  L2.ancestors
p  L3.ancestors
p  L4.ancestors
p  L5.ancestors


Christoph