[self-interest] Inheritance
Jecel Assumpcao Jr
jecel at merlintec.com
Tue Nov 25 18:16:35 UTC 2003
On Tuesday 25 November 2003 12:56, helenameyer2000 wrote:
> We want to change an objects slot (which is called "slider"), without
> changing the prototype of this obejct.
> Every time we change the value for slider in an object, the
> corresponding slider-slot in the prototype also get changed..
> How do we avoid this?
Are you calling "prototype" the object from which you cloned or copied
your new object (to which you are sending the 'slider:' message)? Or is
it some parent of your new object?
Your problem shouldn't be happening in the first case, which is how we
use these terms in Self. Other prototype based programming languages
have a different notion of prototype.
(| parent* = traits clonable.
slider <- 7
|) copy slider: 10
has no effect on the slider slot of the original (prototype) object,
while
(| parent* = (| parent* = traits clonable. slider <- 7 |).
localData <- 0
|) slider: 10
will change the parent (we don't call it prototype in Self) object,
which will affect the child object as well.
> In traits sliderMorph, in the method verticalMouseMove: evt,
> we want to change the position of the pluggableOutliner.
>
> So far we have the following:
>
> target position: ((target position x) @ (target position y - 75))
>
> and target is set to pluggableOutliner.
>
> But nothing happens..?
That looks about right and it is possible that it even worked but didn't
see the results. Try adding the line
target changed.
after the one the moves the object.
-- Jecel
More information about the Self-interest
mailing list