[squeak-dev] Re: Selectors with underscores

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Mar 17 19:44:04 UTC 2010


2010/3/17 Yoshiki Ohshima <yoshiki at vpri.org>:
> At Fri, 12 Mar 2010 20:01:41 +0100,
> Stéphane Rollandin wrote:
>>
>> > IMHO, both := and _ are wrong choices. To be consistent with selector
>> > conventions, it should have been =: ( for assign:). But I guess it is too late
>> > now.
>>
>> ah, but _ is not a selector
>>
>> now if a newly created identifier symbol was automatically bound to a
>> specific instance of ProtoObject, instead of nil which is the sole
>> instance of UndefinedObject, then =: could be implemented in ProtoObject
>> as syntactic sugar for becomeForward:
>>
>> or am I wrong here ?
>
>  Hehe.  But if a variable (say an instance variable "x" of an object
> "obj") already has a non-nil value, what does that mean?
>
>  In Smalltalk 72, the left arrow was a message to an atom, in deed.
> The index finger hand literal object can be sent a string to get an
> atom object and it in turn can receive an left arrow message with an
> argument.  You can assign atom into another variable.  You can define
> the left arrow message for a collection to mean "add" instead assign.
> For an instance variable, you can use "'s" message followed by a
> string also to get the corresponding atom in the reciver context.
>
> -- Yoshiki
>

Even in st80, instVarAt:put: and tempAt:put: still are messages
anyway. It's just that there is a nicer syntax, and an optimized
byteCode, but strictly speaking, Smalltalk does not require any
assignment, nor does it require jumps.
Think of basicAt:put:, it does nor even have a special syntax nor a
byteCode (well, maybe I should check new closure byteCodes, but no
image running).

Nicolas



More information about the Squeak-dev mailing list