[self-interest] Propogating slot changes in Morphs

Russell Allen mail at russell-allen.com
Fri Apr 16 02:20:50 UTC 2010


The concept of 'copy down' slots sounds close - see
http://docs.selflanguage.org/howtoprg.html at 5.4.6 for some info. Basically
the mechanism is part of the transporter.

 

But I think you're looking for something more general. 

 

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. I wonder how hard that would be to create. Maybe something like:

 

a: (| slot: 23. "default value" slot: x = ( "use a mirror to create a slot
called 'slot' and set the value to x" ) |)

b: (| parent* = a |)

 

so the first time we send 'slot: 50', the method 'slot:' in object a creates
a slot 'slot <- 50' in b, and after that all calls to 'slot:' on b refer to
the local slot.

 

But I'm not in front of my laptop so I've no idea if that is feasible.

 

Russell

 

 

 

From: self-interest at yahoogroups.com [mailto:self-interest at yahoogroups.com]
On Behalf Of Chris Double
Sent: Friday, 16 April 2010 11:43 AM
To: self-interest at yahoogroups.com
Subject: [self-interest] Propogating slot changes in Morphs

 

  

When doing the scrolling changes in my image I added a slot to 
WorldMorph to hold the current point when initiating the scroll. The 
methods in the WorldMorph traits object used this to read/write and do 
scrolling.

This didn't change existing WorldMorphs since they are clones of 
WorldMorph and the data slots are actually held in the morph, not a 
parent slot. So I manually re-added the slot in all existing 
WorldMorph's to prevent errors when the WorldMorph trait methods were 
called.

Is there a way to do this automatically when adding/changing slots in a 
Morph? What's the idiom in Self for dealing with this sort of thing?

Chris.
-- 
http://www.bluishcoder.co.nz



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/5d9bd8bb/attachment.html>


More information about the Self-interest mailing list