[squeak-dev] Gereric message catching proxy implementation Was: (Re: Detecting DNU sent by VM, not by code)

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

[squeak-dev] Gereric message catching proxy implementation Was: (Re: Detecting DNU sent by VM, not by code)

Igor Stasenko
Here the abstract implementation of proxy which could catch any
messages except those, which handled by VM directly, like #class.

You can implement own proxy by subclassing
MessageCatchingProxy
and providing own implementation of
#handleMessage:forProxy:

I'm not sure, if it should be in 'Kernel-Methods'.
I just thinking that it could be quite useful to people who need
proxies or different message catching techniques, because it provides
a really clean message catching comparing to any proxy which is
subclass of ProtoObject or Object, because such kind of proxies can't
cleanly intercept messages implemented in those classes without
completely overriding them:

ProtoObject methodDict size 35
Object methodDict size 454

--
Best regards,
Igor Stasenko AKA sig.



MessageCatchingProxy.st (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Gereric message catching proxy implementation Was: (Re: Detecting DNU sent by VM, not by code)

Igor Stasenko
oops, there is one glitch
-i forgot to remove 'unwrapSelector' ivar :)

2008/11/25 Igor Stasenko <[hidden email]>:

> Here the abstract implementation of proxy which could catch any
> messages except those, which handled by VM directly, like #class.
>
> You can implement own proxy by subclassing
> MessageCatchingProxy
> and providing own implementation of
> #handleMessage:forProxy:
>
> I'm not sure, if it should be in 'Kernel-Methods'.
> I just thinking that it could be quite useful to people who need
> proxies or different message catching techniques, because it provides
> a really clean message catching comparing to any proxy which is
> subclass of ProtoObject or Object, because such kind of proxies can't
> cleanly intercept messages implemented in those classes without
> completely overriding them:
>
> ProtoObject methodDict size 35
> Object methodDict size 454
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: Gereric message catching proxy implementation Was: (Re: Detecting DNU sent by VM, not by code)

Klaus D. Witzel
In reply to this post by Igor Stasenko
On Mon, 24 Nov 2008 23:21:37 +0100, Igor Stasenko wrote:

> Here the abstract implementation of proxy which could catch any
> messages

Nice catch knowing that VM continues lookup at the superclass if it found  
nil instead of a MethodDictionary ;)

> except those, which handled by VM directly, like #class.

-  
http://lists.squeakfoundation.org/pipermail/squeak-dev/2008-November/132520.html

> You can implement own proxy by subclassing
> MessageCatchingProxy
> and providing own implementation of
> #handleMessage:forProxy:
>
> I'm not sure, if it should be in 'Kernel-Methods'.
> I just thinking that it could be quite useful to people who need
> proxies or different message catching techniques, because it provides
> a really clean message catching comparing to any proxy which is
> subclass of ProtoObject or Object, because such kind of proxies can't
> cleanly intercept messages implemented in those classes without
> completely overriding them:
>
> ProtoObject methodDict size 35
> Object methodDict size 454
>


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Gereric message catching proxy implementation Was: (Re: Detecting DNU sent by VM, not by code)

Igor Stasenko
2008/11/25 Klaus D. Witzel <[hidden email]>:
> On Mon, 24 Nov 2008 23:21:37 +0100, Igor Stasenko wrote:
>
>> Here the abstract implementation of proxy which could catch any
>> messages
>
> Nice catch knowing that VM continues lookup at the superclass if it found
> nil instead of a MethodDictionary ;)
>
:)

>> except those, which handled by VM directly, like #class.
>
> -
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2008-November/132520.html
>
Yeah, with this trick, and some more efforts, its now possible to
implement a truely transparent proxes in squeak.

>> You can implement own proxy by subclassing
>> MessageCatchingProxy
>> and providing own implementation of
>> #handleMessage:forProxy:
>>
>> I'm not sure, if it should be in 'Kernel-Methods'.
>> I just thinking that it could be quite useful to people who need
>> proxies or different message catching techniques, because it provides
>> a really clean message catching comparing to any proxy which is
>> subclass of ProtoObject or Object, because such kind of proxies can't
>> cleanly intercept messages implemented in those classes without
>> completely overriding them:
>>
>> ProtoObject methodDict size 35
>> Object methodDict size 454
>>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] re: Generic message catching proxy implementation

ccrraaiigg

 > ...except those, which handled by VM directly, like #class.
 >
 > ...
 >
 > ...with this trick, and some more efforts, its now possible to
 > implement a truely transparent proxes in squeak.

      (Obligatory, non-judgemental mention of equivalent result from
2003 in Spoon. :)


-C

--
Craig Latta
improvisational musical informaticist
www.netjam.org
Smalltalkers do: [:it | All with: Class, (And love: it)]