I had temporarily forgotten that a Class is-a Module, so maybe there's no
problem after all. I just wrap all of the base classes (Base1, Base2 and
Base3) normally and then mix the "non-primary" base classes into Derived, e.g.
class Base1; end
class Base2; end
class Base3; end
class Derived < Base1
include Base2
include Base3
end
Oh, well I hoped I had found a quick and elegant solution to the
problem, but as Guy points out:
$ cat hopeful.rb
class Base1; end
class Base2; end
class Derived < Base1
include Base2
end
$ ruby hopeful.rb
hopeful.rb:6:in `include': wrong argument type Class (expected
Module) (TypeError)
from hopeful.rb:6
I’m sure there’s a good reason, but why this restriction?