Catching message send

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Catching message send

Mathieu SUEN
Hi,

Is there a way to catch message send to a specifoque object?

Thanks
        Math
       
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Catching message send

Frank Urbach
Hi Mathieu,

what do you want do?

Cheers,
  Frank

-------- Original Message --------
Subject: [Newbies] Catching message send (31-Okt-2006 11:32)
From:    Mathieu <[hidden email]>
To:      [hidden email]

> Hi,
>
> Is there a way to catch message send to a specifoque object?
>
> Thanks
> Math
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Catching message send

Scott Wallace-2
In reply to this post by Mathieu SUEN
One common, if unartful, technique for doing this kind of thing while  
debugging is temporarily to stash a reference to the specific object  
in a global, and then, in the method in question, check to see if the  
receiver is that object.

Thus, in an Inspector on the object in question, evaluate, say,  
"Smalltalk at: #AA put: self".

Then in the method in question, put something like  "self == AA  
ifTrue: [self halt]"

To clean up afterwards, you can evaluate "Smalltalk removeKey: #AA  
ifAbsent: []" and, of course remove the debugging code from the method.

Cheers,

   -- Scott


On Oct 31, 2006, at 2:32 AM, Mathieu wrote:

> Hi,
>
> Is there a way to catch message send to a specifoque object?
>
> Thanks
> Math
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Catching message send

Mathieu SUEN
In reply to this post by Frank Urbach
Frank Urbach a écrit :
> Hi Mathieu,
>
> what do you want do?
>
> Cheers,
>   Frank
>

I want to catch evry message to an IRBuilder but manage to do it in my own way.
It just to know if there is a Simple way.

CatchIRSend>>doesNotUnderstand: aMessage

        | message |
        message := aMessage selector asString.
        aMessage arguments do:[:each | message := message, ' ', each printString].
        messageSend add: message.
        irBuilder perform: aMessage selector withArguments: aMessage arguments
       

Math
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Catching message send

Mathieu SUEN
In reply to this post by Scott Wallace-2
Sorry I forgot to tell that I want to catch evry message

Scott Wallace a écrit :

> One common, if unartful, technique for doing this kind of thing while
> debugging is temporarily to stash a reference to the specific object in
> a global, and then, in the method in question, check to see if the
> receiver is that object.
>
> Thus, in an Inspector on the object in question, evaluate, say,
> "Smalltalk at: #AA put: self".
>
> Then in the method in question, put something like  "self == AA ifTrue:
> [self halt]"
>
> To clean up afterwards, you can evaluate "Smalltalk removeKey: #AA
> ifAbsent: []" and, of course remove the debugging code from the method.
>
> Cheers,
>
>   -- Scott
>
>
> On Oct 31, 2006, at 2:32 AM, Mathieu wrote:
>
>> Hi,
>>
>> Is there a way to catch message send to a specifoque object?
>>
>> Thanks
>>     Math
>>    

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Catching message send

Fabio Oliveira
In reply to this post by Mathieu SUEN
What about AspectS (Aspect Oriented Programming) ?

Fabio
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners