Multiple inheritance with metaclasses not setup
correctly: this is
a bug, which I have tried to explain/report to
Bo:blingen for years, but was not really
successful. This is a new attempt to describe/demo the
problem. The enclosed program
"testmc.rex" contains four metaclasses:
one metaclass ("Counter") which counts the number
of times an instance of a class is
created by intercepting the message "new",
counting its invocation and forwarding to
the superclass to do the actual instantiation,
one metaclass ("Singleton") which implements the
singleton pattern, ie. no matter how
many times an instance is requested, only one will
be created and returned,
one metaclass ("Counter_Singleton"): subclasses
"Counter", inherits "Singleton" used
in object class "testCS",
one metaclass ("Singleton_Counter"): subclasses
"Singleton", inherits "Counter" used
in object class "testSC".
It seems, that the inherited class(es) are not looked
up on method resolution (e.g.
forwarding NEW and rgfTest to super would print out
the name of the metaclass and the
method running: NEW should appear twice for each
object, once in "Counter" and once in
"Singleton", sequence depending on which metaclass is
used to build class object from.
The output from running this program is attached as well.