[self-interest] Re: Method are not objects?

Marko Mikulicic marko at seul.org
Wed Oct 25 15:32:10 UTC 2000

Hi, I'm back :-)

I agree with you, Richard. I think that the fact that methods are real
objects and that they can
be directly created and manipulated, must be consistent through the
For example:

if ( | slotname = <expression>| )
then in ( | a:b: = (| :arg1 . :arg2| <some code>) | ) , (| :arg1 . :arg2|
<some code>) is an expression,
wich evaluates the method object, not the result of the method invocation.
IMHO, to be consistent with slot initialization, literal method reference
must be allowed (no autoinvocation).
In this case, the evaluation is moved from the object to the slot. For
example, in Self4 a reference to a method
causes it's evaluation (throug a slot or a literal). In OpenSelf, my
implementation, accessing a slot evaluates
the contained method if it is a method, or returns the data if it is data. I
decided this because of two considerations:
    1. If methods are so "volatile", they cannot be taken in hand, touched,
handled, from where did all these method come from? answer: with slot
initialization. The slot initialization syntax is then something different,
special. The mirrors are something extern to the language and can be useful
to handle, for example, names of slots in a debugger, but not something so
essential as methods.
    2. A method is tied to the object where the method is defined and a
method must be the consequence of a message .When invoking a method there
also must be a reciever (self).When auto evaluating the method, what is
        (|a| a: 3 . (|| a: 4) . a print )   ? (I have no more a running Self
to test that  <:-(

Will this little language dialectization of OpenSelf lead to major
incopatibilities with existing Self4 code?
Does Self 4 use this autoinvocation, or depends on it? (local variables,
scoping, ...)

I propose an additional language feature:

 ( | a = <method> . a: = <method> . + <method> . a:B: <method> |)

a:: accesses the <method> in the slot "a" directly without evaluation.
a::: for the slot "a:"
+: for "+"
a:B::: for "a:B:"
Appending a double colon "::" says "don't evaluate".

This maybe complicates a bit the language but then it could be more
self-sufficient, without needing mirrors
too much, and also would allow programmatic changes of initialized local
variables for future invocations of a method wich could improve the
distribution and the chaos of slots in a complex object and the
implementation of "static slots"
(like static local vars in C).
(| mymethod =  (| a <- 4| a print. (mymethod:: a: a-1 a) = 0 ifFalse:
wich would print "4321"

This is only an idea. What do you think?


More information about the Self-interest mailing list