Hi, I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. _JOURNAL OF OBJECT ORIENTED PROGRAMMING_, 1999, vol. 12, p. 39-50). I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ? Steven.
Hi 2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. *JOURNAL OF OBJECT ORIENTED PROGRAMMING*, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like: YourGhostBehaviour>>currentMetaLevel ^GHMetaLevel empty Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described. 2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. *JOURNAL OF OBJECT ORIENTED PROGRAMMING*, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel
^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
This is the difference between Forwarding and Delegation [1]. Accessorily to this discussion, the name "Virus" does not yet convince me: - first, it has a negative connotation in informatics. People do not want to have virus installed. They do not want virus infecting their machines. People using Pharo for business will not install Viruses nor write ones :) - regarding the metaphorical aspect, a virus contaminates an organism, and moreover, we want to eliminate it not keep it... - besides, Virus might be a fancy name, but you already have a fancy/fantasy name in the project: Ghost. Thus, I would not call the class implementing such behavior a virus. The "meta" vocabulary is already complex, and specially the one around proxies. I think that adding virus to it only complexifies even more the context... I would stick with the behavior used by the rest of the world in this case. Guille [1]https://en.wikipedia.org/wiki/Forwarding_(object-oriented_programming)#Examp... -------- Original Message --------
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com <mailto:dionisiydk@gmail.com>>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io <mailto:steven.costiou@kloum.io>>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. /JOURNAL OF OBJECT ORIENTED PROGRAMMING/, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel
^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
Le 28/7/16 à 12:11, Guille Polito a écrit : > This is the difference between Forwarding and Delegation [1]. > > Accessorily to this discussion, the name "Virus" does not yet convince me: > - first, it has a negative connotation in informatics. People do not > want to have virus installed. They do not want virus infecting their > machines. People using Pharo for business will not install Viruses nor > write ones :) + 1000000 > - regarding the metaphorical aspect, a virus contaminates an > organism, and moreover, we want to eliminate it not keep it... > - besides, Virus might be a fancy name, but you already have a > fancy/fantasy name in the project: Ghost. Thus, I would not call the > class implementing such behavior a virus. The "meta" vocabulary is > already complex, and specially the one around proxies. I think that > adding virus to it only complexifies even more the context... I would > stick with the behavior used by the rest of the world in this case. > > Guille > > > > [1]https://en.wikipedia.org/wiki/Forwarding_(object-oriented_programming)#Examples > > -------- Original Message -------- >> I think I not understood second part of "self problem" in this paper. >> But self sends are covered by virus as I described. >> >> 2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com >> <mailto:dionisiydk@gmail.com>>: >> >> Hi >> >> 2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>: >> >> Hi, >> >> I use virus from Ghost to intercept messages sent to a given >> object and adapt methods behaviors for this particular object >> only. However it would seems that doing interception this way >> is subject to the "self problem" described in this paper from >> Stéphane (DUCASSE, Stéphane. Evaluating message passing >> control techniques in Smalltalk. /JOURNAL OF OBJECT ORIENTED >> PROGRAMMING/, 1999, vol. 12, p. 39-50). >> >> I understand i could do instance based adaptation using an >> other technique, but i wonder if there is any way with Ghost >> to deal with this "self problem" problem ? >> >> I think "self problem" is only related to classic proxies when >> objects stay behind them. But ObjectVirus is not proxy in this >> meaning. When you infect your object by virus it is not replaced >> by somebody else. It is same original instance but with >> overridden behaviour. That's why I call it virus without any >> relation to proxies. >> Any message to infected object is processed by your behaviour. >> All self sends are intercepted. But there are few exceptions: >> - special messages like ==,ifTrue/ifNil are not intercepted >> - meta messages are not intercepted. They processed by Ghost >> mechanics but they not passed to your behaviour. Meta messages >> defined by #currentMetaLevel of your behaviour. You could >> implement it like: >> >> YourGhostBehaviour>>currentMetaLevel >> >> ^GHMetaLevel empty >> >> >> Empty meta level means that all messages will be passed to your >> behaviour. There is also "GHMetaLevel standard" which is default >> one. It makes most of "tool messages" not interceptable. For >> example #printString, #class, #instVarAt: will be not >> intercepted. It's messages which are usually used by tools like >> inspector and debugger. >> Standard meta level simplifies debugging of new behaviours. If >> you make mistake somewhere standard messages will be not broken >> and you could debug error by tools. >> >> >
Hi, I think i am missing something. For example in the following code (took from the tests): | victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new. victim := 0@0 corner: 3@4. virus infect: victim. victim corner The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit :
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. _JOURNAL OF OBJECT ORIENTED PROGRAMMING_, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ? I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel ^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
I do not like either the âvirusâ name. not just because is negative in a subjective way⦠also it hides what it does inside a fantasy name, and that IMO is negative to self discovery of the system. I mean⦠a framework can have a fantasy name⦠but a class? A method name? (#infect:⦠come on!) I know is âcool", but if I read the code below, I have NO CLUE of what is going to happen, and thatâs not good. Esteban
On 28 Jul 2016, at 12:33, Steven Costiou <steven.costiou@kloum.io> wrote:
Hi,
I think i am missing something.
For example in the following code (took from the tests):
| victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim. victim corner
The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit :
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com <mailto:dionisiydk@gmail.com>>: Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io <mailto:steven.costiou@kloum.io>>: Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. JOURNAL OF OBJECT ORIENTED PROGRAMMING, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel ^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
Am 28.07.2016 um 12:56 schrieb Esteban Lorenzano <estebanlm@gmail.com>:
I do not like either the âvirusâ name. not just because is negative in a subjective way⦠also it hides what it does inside a fantasy name, and that IMO is negative to self discovery of the system.
I mean⦠a framework can have a fantasy name⦠but a class? A method name? (#infect:⦠come on!)
I know is âcool", but if I read the code below, I have NO CLUE of what is going to happen, and thatâs not good.
+100 Norbert
Esteban
On 28 Jul 2016, at 12:33, Steven Costiou <steven.costiou@kloum.io <mailto:steven.costiou@kloum.io>> wrote:
Hi,
I think i am missing something.
For example in the following code (took from the tests):
| victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim. victim corner
The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit :
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com <mailto:dionisiydk@gmail.com>>: Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io <mailto:steven.costiou@kloum.io>>: Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. JOURNAL OF OBJECT ORIENTED PROGRAMMING, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel ^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
2016-07-28 12:56 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
I do not like either the âvirusâ name. not just because is negative in a subjective way⦠also it hides what it does inside a fantasy name, and that IMO is negative to self discovery of the system.
I mean⦠a framework can have a fantasy name⦠but a class? A method name? (#infect:⦠come on!)
I know is âcool", but if I read the code below, I have NO CLUE of what is going to happen, and thatâs not good.
virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim.
As any framework you need to know something about it. And description here is quite simple: virus is a guy who changes behaviour of infected objects. What you think about renaming virus to mutation? mutation := GHObjectMutation behaviour: GHGhostBehaviourStub new. victim := 0@0 corner: 3@4. mutation infect: victim. Is it makes any sense for you? You should understand that ObjectVirus is specific kind of ghost for real object interception. It is not general proxy because it make concrete decisions about class side behaviour of infected instances and about their meta level. Also there are other "real object ghosts" (I remember Guille is implementing Membrane). I try to say that it is quite difficult to call different kind of ghosts without distinguishing them by some kind of metaphor. It is easy to be lost inside many "general" proxy names.
Denis, I recommend that you read carefully the paper that Steven sent (the one about message passing, that Stef wrote many years ago :)). If you read carefully, you'll see that what you call object virus is already there, and falls into the category "anonymous classes". Maybe you can get some ideas for names in there. Some ideas that come to my mind: - Your virus *intercepts* messages, it does . - Your virus actually allows you to change the *meta-object* of an object (and thus how it receives messages). - Moreover you can handle several meta-levels, so it's not a single meta-object. -------- Original Message --------
2016-07-28 12:56 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>>:
I do not like either the âvirusâ name. not just because is negative in a subjective way⦠also it hides what it does inside a fantasy name, and that IMO is negative to self discovery of the system.
I mean⦠a framework can have a fantasy name⦠but a class? A method name? (#infect:⦠come on!)
I know is âcool", but if I read the code below, I have NO CLUE of what is going to happen, and thatâs not good.
virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim.
As any framework you need to know something about it. And description here is quite simple: virus is a guy who changes behaviour of infected objects. What you think about renaming virus to mutation?
mutation := GHObjectMutation behaviour: GHGhostBehaviourStub new. victim := 0@0 corner: 3@4. mutation infect: victim.
Is it makes any sense for you?
You should understand that ObjectVirus is specific kind of ghost for real object interception. It is not general proxy because it make concrete decisions about class side behaviour of infected instances and about their meta level. Also there are other "real object ghosts" (I remember Guille is implementing Membrane).
I try to say that it is quite difficult to call different kind of ghosts without distinguishing them by some kind of metaphor. It is easy to be lost inside many "general" proxy names.
On Thu, Jul 28, 2016 at 10:21 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2016-07-28 12:56 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com>:
I do not like either the âvirusâ name. not just because is negative in a subjective way⦠also it hides what it does inside a fantasy name, and that IMO is negative to self discovery of the system.
I mean⦠a framework can have a fantasy name⦠but a class? A method name? (#infect:⦠come on!)
I know is âcool", but if I read the code below, I have NO CLUE of what is going to happen, and thatâs not good.
virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim.
As any framework you need to know something about it. And description here is quite simple: virus is a guy who changes behaviour of infected objects.
It also self propagates, which this does not. Maybe its a dead virus like they put in vaccines?
What you think about renaming virus to mutation?
mutation := GHObjectMutation behaviour: GHGhostBehaviourStub new. victim := 0@0 corner: 3@4. mutation infect: victim.
I like that better. Way back when you first announced GHObjectVirus it jarred a nerve with me, but I restrained myself from commenting at the time. Though maybe(?) 'mutation" a little passive and GHObjectMutator might fit better (but its quite a small distinction). btw the term #infect: is quite loaded with negative connotations. Maybe overall its... mutator mutate: victim.
Is it makes any sense for you?
(grammar sensei says "Does that make any sense to you?")
You should understand that ObjectVirus is specific kind of ghost for real object interception.
Your use of that last term to describe this indicates GHObjectInterceptor might be a reasonable alternative. Though perhaps that sounds like its intercepting Objects when its intercepting Messages. So maybe GHMessageInterceptor(??) (and now it sounds like a sleek starship) cheers -ben
It is not general proxy because it make concrete decisions about class side behaviour of infected instances and about their meta level. Also there are other "real object ghosts" (I remember Guille is implementing Membrane).
I try to say that it is quite difficult to call different kind of ghosts without distinguishing them by some kind of metaphor. It is easy to be lost inside many "general" proxy names.
Thank's Ben. 2016-07-29 13:11 GMT+02:00 Ben Coman <btc@openinworld.com>:
Your use of that last term to describe this indicates GHObjectInterceptor might be a reasonable alternative. Though perhaps that sounds like its intercepting Objects when its intercepting Messages. So maybe GHMessageInterceptor(??) (and now it sounds like a sleek starship)
Problem that there are many kinds of interceptors for real object and they all needs name
Ok by digging a bit, i found that it was a problem in my behavior though i don't understand it. When sending message to self, the #isMetaMessage: returns always true when evaluating the first test condition GHCurrentMetaLevelDepth value > 0 ifTrue: [ ^true ]. The value returns something higher than 0 and my "self messages" are considered to be meta-messages. It is very sensible to modifications, as just removing this test or try to bend it can freezes the image (just tried to see what would happen). I'm a bit lost, what should i do to consider "self messages" not "meta" in the behavior ? Le 2016-07-28 12:33, Steven Costiou a écrit :
Hi,
I think i am missing something.
For example in the following code (took from the tests):
| victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim. victim corner
The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit : I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. _JOURNAL OF OBJECT ORIENTED PROGRAMMING_, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ? I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel ^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
-- kloum.io
Steven, I fixed it. Load development version (or just this: Ghost-ObjectVirus-DenisKudryashov.12). I will update stable soon 2016-07-28 13:46 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Ok by digging a bit, i found that it was a problem in my behavior though i don't understand it.
When sending message to self, the #isMetaMessage: returns always true when evaluating the first test condition GHCurrentMetaLevelDepth value > 0 ifTrue: [ ^true ]. The value returns something higher than 0 and my "self messages" are considered to be meta-messages. It is very sensible to modifications, as just removing this test or try to bend it can freezes the image (just tried to see what would happen).
I'm a bit lost, what should i do to consider "self messages" not "meta" in the behavior ?
Le 2016-07-28 12:33, Steven Costiou a écrit :
Hi,
I think i am missing something.
For example in the following code (took from the tests):
| victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim. victim corner
The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit :
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. *JOURNAL OF OBJECT ORIENTED PROGRAMMING*, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel
^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
-- kloum.io
And stable version 2.2.2 is done 2016-07-28 14:05 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Steven, I fixed it. Load development version (or just this: Ghost-ObjectVirus-DenisKudryashov.12).
I will update stable soon
2016-07-28 13:46 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Ok by digging a bit, i found that it was a problem in my behavior though i don't understand it.
When sending message to self, the #isMetaMessage: returns always true when evaluating the first test condition GHCurrentMetaLevelDepth value > 0 ifTrue: [ ^true ]. The value returns something higher than 0 and my "self messages" are considered to be meta-messages. It is very sensible to modifications, as just removing this test or try to bend it can freezes the image (just tried to see what would happen).
I'm a bit lost, what should i do to consider "self messages" not "meta" in the behavior ?
Le 2016-07-28 12:33, Steven Costiou a écrit :
Hi,
I think i am missing something.
For example in the following code (took from the tests):
| victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim. victim corner
The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit :
I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. *JOURNAL OF OBJECT ORIENTED PROGRAMMING*, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ?
I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel
^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
-- kloum.io
Thank you very much =) It works perfectly ! Steven. Le 2016-07-28 14:05, Denis Kudriashov a écrit :
Steven, I fixed it. Load development version (or just this: Ghost-ObjectVirus-DenisKudryashov.12).
I will update stable soon
2016-07-28 13:46 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Ok by digging a bit, i found that it was a problem in my behavior though i don't understand it.
When sending message to self, the #isMetaMessage: returns always true when evaluating the first test condition GHCurrentMetaLevelDepth value > 0 ifTrue: [ ^true ]. The value returns something higher than 0 and my "self messages" are considered to be meta-messages. It is very sensible to modifications, as just removing this test or try to bend it can freezes the image (just tried to see what would happen).
I'm a bit lost, what should i do to consider "self messages" not "meta" in the behavior ?
Le 2016-07-28 12:33, Steven Costiou a écrit :
Hi,
I think i am missing something.
For example in the following code (took from the tests):
| victim virus actual | virus := GHObjectVirus behaviour: GHGhostBehaviourStub new.
victim := 0@0 corner: 3@4. virus infect: victim. victim corner
The evaluation is trapped by the send:to: method in the behavior (i've put a halt there). However if i replace the "corner" message by an inspect of the victim, and if i evaluate "self corner", then the message is processed without going through the send:to: method of the behavior. It is not halted and the victim responds immediately to the message. I have also tried to add a new method in the Rectangle class that calls "self corner". When called in the playground, my new message is trapped but not the "corner" sent to self.
From what i understand it could be related to the behavior i use, but i don't see what's missing.
Le 2016-07-28 11:35, Denis Kudriashov a écrit : I think I not understood second part of "self problem" in this paper. But self sends are covered by virus as I described.
2016-07-28 11:30 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.costiou@kloum.io>:
Hi,
I use virus from Ghost to intercept messages sent to a given object and adapt methods behaviors for this particular object only. However it would seems that doing interception this way is subject to the "self problem" described in this paper from Stéphane (DUCASSE, Stéphane. Evaluating message passing control techniques in Smalltalk. _JOURNAL OF OBJECT ORIENTED PROGRAMMING_, 1999, vol. 12, p. 39-50).
I understand i could do instance based adaptation using an other technique, but i wonder if there is any way with Ghost to deal with this "self problem" problem ? I think "self problem" is only related to classic proxies when objects stay behind them. But ObjectVirus is not proxy in this meaning. When you infect your object by virus it is not replaced by somebody else. It is same original instance but with overridden behaviour. That's why I call it virus without any relation to proxies. Any message to infected object is processed by your behaviour. All self sends are intercepted. But there are few exceptions: - special messages like ==,ifTrue/ifNil are not intercepted - meta messages are not intercepted. They processed by Ghost mechanics but they not passed to your behaviour. Meta messages defined by #currentMetaLevel of your behaviour. You could implement it like:
YourGhostBehaviour>>currentMetaLevel ^GHMetaLevel empty
Empty meta level means that all messages will be passed to your behaviour. There is also "GHMetaLevel standard" which is default one. It makes most of "tool messages" not interceptable. For example #printString, #class, #instVarAt: will be not intercepted. It's messages which are usually used by tools like inspector and debugger. Standard meta level simplifies debugging of new behaviours. If you make mistake somewhere standard messages will be not broken and you could debug error by tools.
participants (7)
-
Ben Coman -
Denis Kudriashov -
Esteban Lorenzano -
Guille Polito -
Norbert Hartl -
stepharo -
Steven Costiou