On 16-May-06, at 9:06 AM, Michael Haupt wrote:
> Hi,
>
> once more, apologies for cross-posting.
>
>> From ClassBuilder, I could see that, when a new class is created, the
> superclass's method dictionary contents are copied to the method
> dictionary of the new class. Still, the interpreter climbs, in
> Interpreter>>lookupMethodInClass:, up the inheritance tree to resolve
> a method.
>
> Why is that? Have I missed a spot where subclass creation does not
> entail method dictionary copying?
I think you must have misunderstood something in the code, unless of
course the code has a bug.
Each class has its own method dictionary (and the metaclass has its
of course) and the methods in the dictionary are those belonging to
the class alone. If we copied methods down from the superclass you
would find that a class such as MultiCompositionScanner would have a
method dict of size (in my 3.8 based image) of 610 instead of the 21
that it actually has. And of course, we wouldn't be going up the
class tree in the VM.
Have you perhaps confused adding a new class with mutating an old
one, where we do indeed 'copy' methods but from the old to the new?
tim
--
tim Rowledge;
[hidden email];
http://www.rowledge.org/timAll computers run at the same speed...with the power off.