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 <dionisi...@gmail.com
<mailto:dionisi...@gmail.com>>:
Hi
2016-07-27 22:19 GMT+02:00 Steven Costiou <steven.cost...@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.