On Mon, Apr 7, 2008 at 1:45 PM, Rick DeNatale [email protected]
module B < A
but you can do:
Which acts like a sort of inheritance.
It does indeed look like that if you ask ruby itself, very much to my
dispair (but that’s why I have implemented traits)
irb(main):003:0> b.send :include, a
irb(main):005:0> b < a
irb(main):007:0> c.send :include, b
irb(main):008:0> c.new.is_a? a
I believe that this is misleading I might agree to
but if we go all the way to ducktyping even that is unacceptable.
And yes you guessed correctly I am an inheritance skeptic but that is
not because it is a bad feature (single inheritance) but it is not the
right feature for code reuse, it is the right feature for modeling.
Smalltalk which had no mixins suffered a lot from having to use SI for
refactoring and code reuse, Squeak implemented traits for that very
reason if I understood correctly.
My blog on Ruby
Whereof one cannot speak, thereof one must be silent.