[self-interest] Propogating slot changes in Morphs
Russell Allen
mail at russell-allen.com
Fri Apr 16 08:47:23 UTC 2010
Just to follow up on my own post :)
obj1: (|
mySlot = 23. "Default value"
mySlot: x = ( _AddSlots: (| mySlot <- 0 |). mySlot: x )
|)
obj2: (| parent* = obj1 |)
seems to work:
obj2 mySlot ---> 23
obj2 mySlot: 34 ---> obj2
obj2 mySlot ---> 34
now obj2 is (| parent* = obj1. mySlot <- 34 |)
Anyone tried this an approach? Do you think it would work in practice?
Russell
From: self-interest at yahoogroups.com [mailto:self-interest at yahoogroups.com]
On Behalf Of Russell Allen
Sent: Friday, 16 April 2010 1:01 PM
To: self-interest at yahoogroups.com
Subject: RE: [self-interest] Propogating slot changes in Morphs
It sounds as if 'clone' has a different meaning in Io? It doesn't mean
'copy' but 'create new child'?
Talking about Self though, I guess it depends on how delegation is
conceptualised. If you think of parents are being shared parts of objects,
then an object is made up of its own slots and also slots it shares with
other objects. It seems as if what is needed is a third concept - slots
which are 'semi-shared'.
Russell
-----Original Message-----
From: self-interest at yahoogroups.com <mailto:self-interest%40yahoogroups.com>
[mailto:self-interest at yahoogroups.com
<mailto:self-interest%40yahoogroups.com> ]
On Behalf Of Chris Double
Sent: Friday, 16 April 2010 12:39 PM
To: self-interest at yahoogroups.com <mailto:self-interest%40yahoogroups.com>
Subject: Re: [self-interest] Propogating slot changes in Morphs
On 16/04/10 14:20, Russell Allen wrote:
> Ideally I suppose what is needed is a slot which 'belongs' to the parent
> object but which nevertheless can have different values depending on the
> child.
Yes, this is similar to how inheritance works in the Io programming
language. When you clone an object it doesn't clone the slots. it does
copy-on-write in that it creates a copy of the cloned objects slots when
you set them on the child. This makes 'data parents' a bit easier to
deal with in that you can add new slots to all cloned objects easier.
Thanks for the pointer to copy down slots - I'll read up on them.
Chris.
--
http://www.bluishcoder.co.nz
------------------------------------
Yahoo! Groups Links
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.801 / Virus Database: 271.1.1/2811 - Release Date: 04/16/10
04:31:00
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.801 / Virus Database: 271.1.1/2811 - Release Date: 04/16/10
04:31:00
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20100416/b6991655/attachment.html>
More information about the Self-interest
mailing list