mirrors (was: [self-interest] Adding method slots dynamically)

Toby Ovod-Everett toby at ovod-everett.org
Thu Aug 18 14:45:02 UTC 2005


On Wed, Aug 17, 2005 at 12:43:59PM -0300, Jecel Assumpcao Jr wrote:
> Two advantages of the "copying is domain behavior" design used in Self
> are that this is a very frequent operation so making it more lightweight
> will improve performance and that having each object control this allows
> the separation of "oddball" objects from "clonable" ones.

In addition, by putting copying in the domain, one makes it easier to override
the copying behavior.  It is rare that an object designer would want to
override the behavior of addSlots, for instance.  It is not that rare that a
designer would want to override the behavior of clone, on the other hand.
Yes, if one puts clone in the mirror, one can still override the behavior of
clone by overriding the behavior of reflect so that it returns an modified
mirror that overrides clone on it's behalf, but that is a convoluted approach
to implementing a common design pattern.

The most common reason to override clone is a need to retain a count or a list
of every object of a given "class".

--Toby Ovod-Everett



More information about the Self-interest mailing list