[self-interest] Re: Method are not objects?
Richard
3prometheus at home.com
Thu Oct 26 01:04:24 UTC 2000
Marko Mikulicic wrote:
> 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.
I think you make a very good point. Until now, I had set aside my unease
with initialization syntax; I don't think I'll be doing this anymore. :-)
> 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
> "self":
> (|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".
I don't know if I agree with this syntax because I'd think of a:: as
a two parameter method. I think a different symbol should be used in
order to distinguish the two operations (perhaps the exclamation mark?).
Does Self have special syntax in x: slots to indicate assignment of a
value to the x slot, or is it automatic that if a slot x exists then
x: /will/ assign its parameter to the slot x? (You know, I'd completely
forgotten that x: could just be a one-parameter method.) If it's the
latter then it doesn't make sense to ask for the method associated with
that slot. OTOH, if special syntax is used in x: slots then the same
scheme should be used in x! slots.
> 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:
> [mymethod])
> wich would print "4321"
>
> This is only an idea. What do you think?
I have to say that if the above is the only use for allowing references
to slots, then junk it. :-/
More information about the Self-interest
mailing list