Messages interceptions without using "halt"

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

Messages interceptions without using "halt"

Steven Costiou-2

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

 

Thanks,

Steven.

Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

Thierry Goubier
Hi Steven,

2016-04-26 14:39 GMT+02:00 Steven Costiou <[hidden email]>:

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

The easiest would be to use proxy or ghost objects, which catches all message sends to a proxy of the real object and let you decide what to do with them. A recent announcement on Ghosts for Pharo 5 was done, maybe starting with that could be an idea.


For old timers: wasn't Actalk done that way ?

Thierry
 

 

Thanks,

Steven.


Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

EstebanLM
it is not what MetaLinks are for?
I think is easier than Ghost nowadays… but not sure :)

look at 

ReflectivityControlTest>>testBeforeSend

seems to be installing an interception “before send”, who is what you are asking for.

Esteban

ps: but I might be wrong… Marcus can explain better :)

On 26 Apr 2016, at 14:50, Thierry Goubier <[hidden email]> wrote:

Hi Steven,

2016-04-26 14:39 GMT+02:00 Steven Costiou <[hidden email]>:

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

The easiest would be to use proxy or ghost objects, which catches all message sends to a proxy of the real object and let you decide what to do with them. A recent announcement on Ghosts for Pharo 5 was done, maybe starting with that could be an idea.


For old timers: wasn't Actalk done that way ?

Thierry
 
 

Thanks,

Steven.



Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

Denis Kudriashov
In reply to this post by Steven Costiou-2
Hi

2016-04-26 14:39 GMT+02:00 Steven Costiou <[hidden email]>:

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

I think it is not possible from image side. As I understand correctly you are going to change general message send mechanizm. You could hack VM for this.
Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

Steven Costiou-2
In reply to this post by EstebanLM

Thank you ! I will look into these possibilities =)

 

Steven.

Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

Thierry Goubier
In reply to this post by EstebanLM


2016-04-26 15:07 GMT+02:00 Esteban Lorenzano <[hidden email]>:
it is not what MetaLinks are for?
I think is easier than Ghost nowadays… but not sure :)

look at 

ReflectivityControlTest>>testBeforeSend

seems to be installing an interception “before send”, who is what you are asking for.

It depends if it is an interception before send or an interception before receive ;)

If one is to change the method lookup, then this is done at the receiver end of the message send, and, then, I think a ghost is more appropriate. Or metalinks upon entry to the receiver method (i.e. method wrappers type of thing).

Thierry
 

Esteban

ps: but I might be wrong… Marcus can explain better :)


On 26 Apr 2016, at 14:50, Thierry Goubier <[hidden email]> wrote:

Hi Steven,

2016-04-26 14:39 GMT+02:00 Steven Costiou <[hidden email]>:

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

The easiest would be to use proxy or ghost objects, which catches all message sends to a proxy of the real object and let you decide what to do with them. A recent announcement on Ghosts for Pharo 5 was done, maybe starting with that could be an idea.


For old timers: wasn't Actalk done that way ?

Thierry
 
 

Thanks,

Steven.




Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

Denis Kudriashov
In reply to this post by Denis Kudriashov
But if you want new message send logic only for your registered objects then you can use Ghost for this. It provides some infrastructure to implement such strange objects

2016-04-26 15:30 GMT+02:00 Denis Kudriashov <[hidden email]>:
Hi

2016-04-26 14:39 GMT+02:00 Steven Costiou <[hidden email]>:

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

I think it is not possible from image side. As I understand correctly you are going to change general message send mechanizm. You could hack VM for this.

Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

stepharo
In reply to this post by Steven Costiou-2


Le 26/4/16 à 14:39, Steven Costiou a écrit :
>
> Hello,
>
> i am not new to Pharo nor to the list but this is the first time i
> speak here, so : hi =)
>

Welcome Steven

> I started a phd a few month ago (with Alain Plantec) on context
> oriented programming and dynamic programs adaptation. I am using Pharo
> for my experiments and i would like to intercept messages sent to an
> object just before they get to their receiver. To be more specific,
> when #msg is sent to an object o, i want to be able to intercept it
> just before it is actually executed with the following objects at my
> disposal : the receiver (o), the message or selector, the sender. My
> objective by doing that is to (try to) change the lookup for a given
> method, and to be able to choose in which class the lookup will start.
>

This is not yet supported by Reflectivity but you should talk to marcus
and help building it and it will be there :)
>
> I have been looking a bit and it does not seem to be a "simple" way to
> do that in Pharo. Is that even possible and if so, any advice on where
> i should look ?
>
> Thanks,
>
> Steven.
>


Reply | Threaded
Open this post in threaded view
|

Re: Messages interceptions without using "halt"

Steven Costiou-2
In reply to this post by EstebanLM

Hi Thierry, Esteban,

i forgot to thnk you for your advices.

I tried Metalinks but it cannot intercept messages receptions. I used Ghost, i have been able to do it with virus-proxies and it works well.

 

 

Le 2016-04-26 15:07, Esteban Lorenzano a écrit :

it is not what MetaLinks are for?
I think is easier than Ghost nowadays... but not sure :)
 
look at 
 
ReflectivityControlTest>>testBeforeSend
 
seems to be installing an interception "before send", who is what you are asking for.
 
Esteban
 
ps: but I might be wrong... Marcus can explain better :)

On 26 Apr 2016, at 14:50, Thierry Goubier <[hidden email]> wrote:

Hi Steven,

2016-04-26 14:39 GMT+02:00 Steven Costiou <[hidden email]>:

Hello,

i am not new to Pharo nor to the list but this is the first time i speak here, so : hi =)

 

I started a phd a few month ago (with Alain Plantec) on context oriented programming and dynamic programs adaptation. I am using Pharo for my experiments and i would like to intercept messages sent to an object just before they get to their receiver. To be more specific, when #msg is sent to an object o, i want to be able to intercept it just before it is actually executed with the following objects at my disposal : the receiver (o), the message or selector, the sender. My objective by doing that is to (try to) change the lookup for a given method, and to be able to choose in which class the lookup will start.

 

I have been looking a bit and it does not seem to be a "simple" way to do that in Pharo. Is that even possible and if so, any advice on where i should look ?

The easiest would be to use proxy or ghost objects, which catches all message sends to a proxy of the real object and let you decide what to do with them. A recent announcement on Ghosts for Pharo 5 was done, maybe starting with that could be an idea.
 
 
For old timers: wasn't Actalk done that way ?
 
Thierry
 
 

Thanks,

Steven.

 

--
kloum.io