[Q] dependency in morph

Stephane Ducasse ducasse at iam.unibe.ch
Fri Sep 6 18:41:59 UTC 2002


Ned

I'm confused. I'm planning to use that for my book which is in 3.2 so 
is it working or not?

Stef


On vendredi, septembre 6, 2002, at 08:34  PM, Ned Konz wrote:

> 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
>
>
>
Dr. Stéphane DUCASSE (ducasse at iam.unibe.ch) 
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do
  different? ... especially if, by doing something different, today
  might not be your last day on earth" Calvin&Hobbes





More information about the Squeak-dev mailing list