Dnia 2020-07-17, o godz. 13:26:31
Zelphir Kaltstahl <zelphirkaltst...@posteo.de> napisaƂ(a):

> Hello Jan,
> 
> to me this sounds like you need to implement perhaps 2 things:
> 
> 1. a setter for the <address-bar>, which takes care of updating
> things, when a completely new <address-bar> is added.
> 
> 2. some kind of observer pattern, where the <file-manager> registers
> itself as a listener to changes in the <address-bar>. Probably a
> method at the <address-bar>, something like
> `register-change-listener`, which adds the argument it takes to a
> list or a set of listeners. Then you need to take care, that on
> relevant updates all registered listeners are notified of the change.
> 
> Furthermore you can register the <file-manager> as a listener at the
> <address-bar> when the <address-bar> is set using the setter and
> unregister as listener at the previously set <address-bar> (which is
> now replaced by the new one).

I'm implementing something like this right now. I'm adding a
<messenger> object to every object needing to do messaging.
Once a message is received, the <messenger> object will run message
handler provided by the parent object.

I'm surprised Guile isn't providing anything like this right now. If my
knowledge is correct, the original idea of OOP was about sending
messages.

> I have not worked with GOOPS yet, so my answer is not GOOPS specific
> and perhaps there are better ways, but I think this is the classic
> approach to the problem.

It seems GOOPS is pretty minimalistic, I couldn't find anything there,
but I didn't yet study the MetaObject Protocol entirely.

> Regards,
> Zelphir


Thanks
Jan Wielkiewicz

Reply via email to