[GOODIE] Delegation and Self like things for Squeak
Rob Withers
rwithers12 at mediaone.net
Wed Aug 22 07:19:56 UTC 2001
RE: [GOODIE] Delegation and Self like things for SqueakStephen,
It works! I get the exampleFamily built and so on.
[big snip]
> Rob...Try this:
>
> - create a new prototype
> - set it's superclass to ProtoObject (necessary to peacefully exist in
> squeak)
> - remove all slots except one, which is *not* a parent slot
> (let's call
> it "target")
> - remove all methods
> - add the following method:
>
> -------
> doesNotUnderstand: aMessage
> "Do your stuff here"
>
> ^target delegate: aMessage selector arguments: aMessage
> arguments
> -------
>
> Does this not give you the power to intercept all messages and do what
> you need to do? In effect, this is an object with a completely
> customized message response scheme (with the exception of the
> ProtoObject methods...which could also be eliminated if a few
> tweeks to
> the base Squeak stuff).
Ok, I am starting to see what you mean now. The key is your statement about
eliminating the need for the base methods, with a few tweaks. This would
give us a very thin object, with 2 slots (one is target adn the other is
doesNotUnderstand:. We could clone this base Forwarder and create a filter
to specialize the delegation. We could even chain them, which is a need of
mine in the AddressSpaces scheme. Thank you for the #delegate: protocol,
although if we are chaining Forwarders, would it not be better to do:
> -------
> doesNotUnderstand: aMessage
> "Do your stuff here"
>
> ^target mirror delegate: aMessage selector arguments: aMessage
> arguments
> -------
Mirror would implement
------
delegate: selector arguments: argArray
^ self reflectee delegate: selector arguments: argArray
-----
then any non-prototype object can implement
------
mirror
^ self
-----
I'll see what I can do with my AddressSpaces code this weekend. For the
time being, I will continue to set the superclass of a Forwarder to
ProtoObject. Thanks again Stephen.
cheers,
Rob
> - Stephen
More information about the Squeak-dev
mailing list
|