A question about method slots

Michael Paap michael at mpaap.de
Sat Mar 8 08:27:11 UTC 2014


Hello list,

I just realized, that I've got a problem with Self's method slots. I 
feel some inconsistence in the used metaphers, as far as I understood 
them, so there must be a lack of understanding. Ill try to describe my 
thoughts and hope, someone can tell me, if I am on the right way.

My background is Java and some knowledge about Smalltalk, so I tend to 
see slots as containers for references to objects. This point of view is 
supported by the name "slot" A slot is something, where I put something 
else in. This resultes in the picture which I appended to this mail.

I realized, that there may be something wrong with my picture, when I 
thought about cloning of objects.

If an object is cloned, a data slot wil be cloned too and the data slots 
of the copy will reference the same object as the corresonding slot of 
the original. If I change stae or behaviour of the referenced object, 
this will affect both, the original and the clone. No problem, business 
as usual.

But what about a method slot? If I edit a method in a clone, the 
original is /not/ affected. Ok... if I take a look at an outliner of an 
object, there is an important difference between data slots and method 
slots; If i "expand" a data slot, I see the object, referenced from this 
slot. If I expand a method slot, I get an editor for the method, 
embedded in te object, to which the method belongs. So, in some way, 
this suggests, that a method slot does not contain a reference to a 
separate method objct, but the method itself as a part of it's object.

But at the other hand, in descriptions of method activation, there is 
told about cloning the method object... so there MUST be an independent 
object.

Hmmm. Maybe, method objects are not stored in their slots as references, 
but as values? But... i have read things like:
"A non-method object simply returns itself when invoked
as a method, a method objects contains a piece of code that’s executed
on invocation. So, if any object can be "invoked as a method", there 
should be no fundamental difference between method objects and other 
objects.

Another point is, that method slots are read-only, but it is still 
possible, to edit methods. If method slots contain references to method 
objects, this is no problem: The slot is read-only, but I can change the 
code of the method object. But there is the contradiction to the 
behaviour of cloned objects, I told above.

You see, I really need some help to adjust my picture...

Greetings,
Michael




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/x-ygp-stripped
Size: 134 bytes
Desc: not available
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20140308/48b030df/attachment.bin>


More information about the Self-interest mailing list