nil or #nil?
Tim Olson
tim at jumpnet.com
Sun Aug 23 18:05:11 UTC 1998
>>>Table _ #( (-1 -1 ) 2 3 nil).
>>>
>>>Apparently, the Smalltalk that T-Gen was written for (?) treats nil as a
>>>special case. But for Squeak, (Table at: 4) == #nil (not nil). This was
>>>pretty tricky since it looks like a nil when you print it out. If you
>>>inspect it, however, you see that it is an array with three elements.
>>>
>>>I'm thinking that this is so confusing that Squeak should adopt the
Pat Caudill writes:
>Well I am looking at an older copy of the document, not the approved one,
>but the ANSI standard states "If an identifier appears as an <array
>element> and it is one of the reserved identifiers nil, true, false the
>value of the coresponding element of the collection is the value of that
>identifier." If you want the symbol nil you say
>Table _ #( (-1 -1 ) 2 3 #nil).
Hmm.. well if it is codified in the ANSI standard, then I will defer to
that. I still personally think it is cleaner and more understandable to
treat literal symbols uniformly, but since #true, #false, and #nil are
treated as special cases in other areas, I can see the utility of the
proposed ANSI semantics.
Now what about the reserved identifiers self and super? ;-)
-- tim
More information about the Squeak-dev
mailing list
|