Hi Marian,<br><br><div class="gmail_quote">On Thu, Dec 8, 2011 at 7:50 AM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 <br>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.<br>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 (the superclass).<br>


<br>Now, when sending #cannotInterpret:  aMessage, it sends as parameter an instance of Message. The thing is that in the instVar &quot;lookupClass&quot; it puts the receiver&#39;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 &quot;self class&quot;. 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. <br>
</blockquote><div><br></div><div>Not quite.  It puts the lookup class in the lookupClass inst var.  So if a super send invokes cannotInterpret: lookupClass will hold the superclass of the method in which the send occurred.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>So, questions:<br><br>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 &quot;self class&quot; ?  is there someone using this hook of #cannotInterpret:?<br>
</blockquote><div><br></div><div>I have no idea.  But given the lookupClass it is a simple matter to walk the hierarchy starting at lookupClass, looking for the first nil methodDictionary.  This will be the class at which cannotInterpret: was initiated.  Isn&#39;t this enough?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2) Ok, I know that I should send an instance of Message with something it is not the lookupClass in the instVar &#39;lookupClass&#39;, but it is a lookupClass in some form ;)<br><br>Thanks in advance,<br clear="all">
<br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>