nil or #nil?
invader at oak.zilker.net
Sun Aug 23 18:07:38 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
OK. Tim is right about breaking existing code. That could be fixed. The
fact that you
couldn't put a nil in a constant array was the reason I thought that
#( nil )
#( #nil )
should be different. I'm happy to work on it either way. Let's get some
more feedback when everyone is actually working. I don't know what we're
More information about the Squeak-dev