Sorry guys. Forget this. I was being so stupid. It is working perfectly.<br><br>Cheers<br><br>Mariano<br><br><div class="gmail_quote">On Thu, Mar 17, 2011 at 10:16 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;">Hi folks. I have a problem and I am completely clueless. I did one simple modification to the method lookup: I want to check whether the class of the receiver is a proxy and if true, send an special message. So I just modify the first lines of:<br>

<br>lookupMethodInClass: class<br>    | currentClass dictionary found |<br>    &lt;inline: false&gt;<br>    self assert: class ~~ objectMemory nilObject.<br>    currentClass := class.<br>    [currentClass ~= objectMemory nilObject]<br>

        whileTrue:<br>        [dictionary := objectMemory fetchPointer: MethodDictionaryIndex ofObject: currentClass.<br>        <br><br style="background-color:rgb(255, 255, 0)"><span style="background-color:rgb(255, 255, 0)">        &quot;  THIS IS MY CHANGE &quot;</span><br style="background-color:rgb(255, 255, 0)">

<span style="background-color:rgb(255, 255, 0)">        (currentClass = (objectMemory splObj: ProxyClass)) ifTrue: [</span><br style="background-color:rgb(255, 255, 0)"><span style="background-color:rgb(255, 255, 0)">            self createActualMessageTo: currentClass.</span><br style="background-color:rgb(255, 255, 0)">

<span style="background-color:rgb(255, 255, 0)">            messageSelector := objectMemory splObj: SelectorHandleProxyInvocation.</span><br style="background-color:rgb(255, 255, 0)"><span style="background-color:rgb(255, 255, 0)">            self sendBreak: messageSelector + BaseHeaderSize</span><br style="background-color:rgb(255, 255, 0)">

<span style="background-color:rgb(255, 255, 0)">                point: (objectMemory lengthOf: messageSelector)</span><br style="background-color:rgb(255, 255, 0)"><span style="background-color:rgb(255, 255, 0)">                receiver: nil.</span><br style="background-color:rgb(255, 255, 0)">

<span style="background-color:rgb(255, 255, 0)">            ^self lookupMethodInClass: (self superclassOf: currentClass)</span><br style="background-color:rgb(255, 255, 0)"><span style="background-color:rgb(255, 255, 0)">        ].</span><br style="background-color:rgb(255, 255, 0)">

<span style="background-color:rgb(255, 255, 0)">        &quot;  HERE FINISH MY CHANGE &quot;</span><br>        <br>        dictionary = objectMemory nilObject ifTrue:<br>            [&quot;MethodDict pointer is nil (hopefully due a swapped out stub)<br>

                -- raise exception #cannotInterpret:.&quot;<br>            self createActualMessageTo: class.<br>            messageSelector := objectMemory splObj: SelectorCannotInterpret.<br>            self sendBreak: messageSelector + BaseHeaderSize<br>

                point: (objectMemory lengthOf: messageSelector)<br>                receiver: nil.<br>            ^self lookupMethodInClass: (self superclassOf: currentClass)].<br>        found := self lookupMethodInDictionary: dictionary.<br>

        found ifTrue: [^currentClass].<br>        currentClass := self superclassOf: currentClass].<br><br>    &quot;Could not find #doesNotUnderstand: -- unrecoverable error.&quot;<br>    messageSelector = (objectMemory splObj: SelectorDoesNotUnderstand) ifTrue:<br>

        [self error: &#39;Recursive not understood error encountered&#39;].<br><br>    &quot;Cound not find a normal message -- raise exception #doesNotUnderstand:&quot;<br>    self createActualMessageTo: class.<br>    messageSelector := objectMemory splObj: SelectorDoesNotUnderstand.<br>

    self sendBreak: messageSelector + BaseHeaderSize<br>        point: (objectMemory lengthOf: messageSelector)<br>        receiver: nil.<br>    ^self lookupMethodInClass: class<br><br><br><br>Now, from the image side, I added ProxyClass and SelectorHandleProxyInvocation  and:<br>

<br>ClassProxy&gt;&gt; handleProxyInvocation: aMessage<br>    Transcript show: &#39;a message: &#39;; aMessage selector, &#39;was sent&#39;; cr.  <br><br><br>If I do ClassProxy new foo.  I see TWO times the message in the Transcript. I mean, handleProxyInvocation:  is being invoke twice per message. <br>

<br>Thanks in advance for any help.<br><font color="#888888"><br>Mariano<br>
</font></blockquote></div><br>