Alex why ghost is not ok? Because you want to have a portable proxy? Stef Le 27/2/15 03:43, Alexandre Bergel a écrit :
Hi!
I have a near-to-be naive question. Maybe there is something obvious, but I cannot see it. Consider the following implementation of a proxy:
-=-=-=-=-=-=-=-=-=-=-=-= Object subclass: #MyProxy instanceVariableNames: 'object'.
MyProxy >> object: anObject object := anObject
MyProxy >> doesNotUnderstand: aMessage ^ object perform: aMessage selector withArguments: aMessage arguments
Object >> wrap self becomeForward: (MyProxy new object: self; yourself) -=-=-=-=-=-=-=-=-=-=-=-=
The problem is with wrap. After the becomeForward:, MyProxy has itself in the object variable. Even self is apparently subject to the #become.
It means that the following code loop indefinitely
-=-=-=-=-=-=-=-=-=-=-=-= d := Dictionary new. d wrap. d add: #foo -> 10 -=-=-=-=-=-=-=-=-=-=-=-=
I know there is Marianoâs library to write proxy. But I still wondering whether this could be done simply. Any idea how to simply create a proxy?
Cheers, Alexandre