[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding side-effects to assignment



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