Adding side-effects to assignment

Danny Jared Epstein dje at scs.carleton.ca
Wed Mar 13 06:52:56 UTC 1991


What I have done in cases like this is to put the data slot (say
fooData) in a parent (say _ fooParent*) and then override the
assignment slot (fooData:) locally with a method:

  fooData: newValue = (
    "do something".
    fooParent.fooData: newValue.    "directed resend"
  ).

This technique lets the read operation be inherited directly and it
avoids the naming problem.  To copy the object, you will have to copy
the parent as well, so you should make the parent inherit from traits
clonable.

- Danny



More information about the Self-interest mailing list