[Vm-dev] #cannotInterpet: use last class rather than receiver's
Mariano Martinez Peck
marianopeck at gmail.com
Thu Dec 8 15:50:57 UTC 2011
Hi guys. When the finds a methodDict in nil during the method lookup, it
sends #cannotInterpret: to the receiver, but starting the methodLookup in
the superclass of the class whose method dict was nil.
Example, if I have A subclass from B and B has the method dict in nil, if I
sent #foo to an instance of A, it will send #cannotInterpret: to such
instance but starting the method lookup (of the #cannotInterpret:) in B
Now, when sending #cannotInterpret: aMessage, it sends as parameter an
instance of Message. The thing is that in the instVar "lookupClass" it puts
the receiver's class. In this example, A. But when you are implementing
#cannotInterpret: such info (the lookupClass) is already there, because
you DO have the receiver (in self), so you could always do a "self class".
In my case, for some proxies I am doing, I would need not the lookupClass,
but the class whose methodDict was nil, in this case, B.
1) Do I break something if I do this? Am I limiting the solution somehow?
it is not always true that I can get the lookupClass while doing "self
class" ? is there someone using this hook of #cannotInterpret:?
2) Ok, I know that I should send an instance of Message with something it
is not the lookupClass in the instVar 'lookupClass', but it is a
lookupClass in some form ;)
Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev