Assume object
is an instance of class C
. Also assume that object
has an instance-specific method m
attached to it. The method m
is defined in both C
and its superclass C0
. The question is, which method should the expression
super m
invoke when self == object, and why?
I see two possible answers:
- C >> #m (the method in the object class)
- C0 >> #m (the method in the object class superclass)
EDIT
Even though the way we implement instance-specific behavior shouldn't matter for the semantics of super
, let me point out that my favorite implementation is the one that places the so called MethodDictionaryArray
(or MDA
for short) in object headers, instead of the object class. As you can imagine, a MDA
contains the method dictionaries of the inheritance chain.
With this implementation you can put instance behavior in a new MethodDictionary
(MD
) and redefine the object's MDA as the nested array #{MD. MDA}
.