nil or #nil?

David N. Smith dnsmith at watson.ibm.com
Tue Aug 25 18:36:25 UTC 1998


At 7:51 -0400 8/24/98, Tim Rowledge wrote:
>> Dan wrote:
>>
>> >>Right now, the rule for what #() does is pretty simple.  Part of the
>> >>Smalltalk design approach is to minimize the number of rules wherever
>> >>possible, even if this means it doesn't always provide the absolute
>> >>most convenient result.
>>
>> Stefan replied:
>>
>> >I hate to contradict the inventor of the language, but the current rule for
>> >literal arrays is more difficult than needed. Why are symbols represented
>> >differently inside literal arrays than outside. IMHO, the rule should be
>> >that #(a b) is an error and only #(#a #b) is permitted.  This would allow
>> >one to simplify the BNF-rule for literals...
>How much simpler can the rule be? It's a literal array, that is an array of
>literals. So it can contain literal numbers, literal strings, literal
>symbols, other literal arrays. Simple. nil & true & self are not literals,
>so they don't go in literal arrays.

I agree that self is not a literal, but I'm not so sure about nil, true,
and false.

It can be argued that they are the only literal representation of three
critical and commonly used values in Smalltalk. They might look like
variables but they really aren't.

So, what is a literal anyway?

Dave
_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author
and not of his employer.





More information about the Squeak-dev mailing list