[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding side-effects to assignment
[ I'm responding the the list only, the propagation on it (even to my
non-internet system) seems instantaneous anyway. I'm getting two,
sometimes three copies because of the CC:'ing ]
On Mar 13, 1:52am, Danny Jared Epstein wrote:
} 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"
} ).
An good solution.
} 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.
How will inheriting from traits clonable get me anything? I'll have
to send the fooParent a 'clone' message anyway.
[ Inheriting is not a solution. Many of my objects will be 'one of a
king' type things. Things that are 'just like x' except for blah. ]
If traits clonable meant that all 'representation parents' (was that
the term you used before?) were automatically cloned when I asked for
a copy, that would be neat. Reimplementing copy in every object is not
my idea of fun...
I'll experiment a little more with this when 1.3 is available.
--
:!mcr!: | The postmaster never | So much mail,
Michael Richardson | resolves twice. | so little time.
HOME: mcr@sandelman.ocunix.on.ca Bell: (613) 237-5629
Small Ottawa nodes contact me about joining ocunix.on.ca!