[Q] dependency in morph
Ned Konz
ned at bike-nomad.com
Fri Sep 6 18:34:01 UTC 2002
On Friday 06 September 2002 10:35 am, Stephane Ducasse wrote:
> > I would like to propagate change between two object.
> > I used the old changed:, update mechanism
> > but I ended up writing
> >
> > Myclass>>update: aSymbol
> >
> > aSumbol =#zork
> > ifTrue: [self m1. ^ self]
> > aSymbol = #zarf
> > ifTrue: [self m2. ^self]
> >
> >
> > Is there a better in morph to do the same
> >
> > I was looking for something like
> >
> >
> > self when: methodX perform: #m2 on: aMyClass
> >
> > Is there something like that because this would be better for my
> > book but I could not find it.
Well, there's all the methods in the Object "events" category. For
instance, you could do this in the observer:
someMorph when: #zork send: #m1 to: self.
someMorph when: #zarf send: #m2 to: self.
and in someMorph:
self triggerEvent: #zork.
However, I'm a bit concerned that the actionSequence registration will
hang on strongly to both the observer and the observed objects. It
uses MessageSends. I wrote WeakMessageSend to fix this problem in the
event mechanism, but I see that it hasn't been used yet (at least in
3.2).
This may have been an oversight.
It may be worth looking at the events implementation in 3.3 to see if
we need to back-port the events code to 3.2.
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|