assignment message (Re: [squeak-dev] Re: Selectors with underscores)

Igor Stasenko siguctua at gmail.com
Thu Mar 18 03:38:34 UTC 2010


On 18 March 2010 01:08, Yoshiki Ohshima <yoshiki at vpri.org> wrote:
> At Wed, 17 Mar 2010 22:35:31 +0100,
> Stéphane Rollandin wrote:
>>
>> Le 17/03/2010 19:32, Yoshiki Ohshima a écrit :
>> > 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?
>>
>> Well, a variable always has a value, nil or non-nil, so I don't really
>> see your point. The thing with the nil value, is that it is shared by
>> all other objects having a nil value. If all nils weren't the same nil,
>> we could becomeForward: any of them into existence as a defined object
>> (in contrast with an UndefinedObject)
>
>  Oh, I interpreted what you said as something like:
>
>    | a b | "create new variables.  (identifier symbols?)"
>    a gets: b.  "???"
>    a gets: 3.  "one of such ProtoObject is becoming 3".
>    a gets: 4.  "???"
>
> and didn't know what would happen.
>

it won't go that way, because #becomeForward: replacing all references
to same object:

a := z.
b := z.
(here a and b pointing to same object - z)

b := x.

now, 'a' should still point to 'z', while 'b' should point to 'x'.
but if you do z becomeForward: x , then both a and b will point to x.

>> Is there a reason, historical or technical, why we need to have only a
>> unique instance of UndefinedObject ?
>
>  Like using the value 0 to mean nil and false, it is possible.  But I
> don't see it helps anything...
>
> -- Yoshiki
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list