nil or #nil?

David N. Smith dnsmith at watson.ibm.com
Fri Aug 28 16:28:43 UTC 1998


At 21:15 -0400 8/25/98, John Brant wrote:
>
>Some other anomalies with # are:
>
>	##Point value new ==> a Point
>	#(##Point) first ==> "#Point -> nil"
>	#(###Point) first value new ==> a Point
>	#(####Point) first ==> "nil -> nil"
>	####Point ==> compiler error
>
>	## ==> "(Character value: 30) -> nil"
>	#(#) ==> compiler error
>	#(##) ==> compiler error


John:

This depends on your implementation.

In IBM Smalltalk, only the second works and it produces an array holding an
Atom. (An Atom is an object with a unique global value, like a symbol, but
only has a name in the development environment. It is written like a symbol
but with two pound signs. In runtime images it has no name. Atom's are used
instead of Symbols for state variables.)

The rest all produce a compile error, except for the first which produces a
runtime error (Atom does not understand #value).


I ran your examples in Squeak 2.1 and got a different result on the third one:

	#(###Point) first value new   (new not understood)

The ###Point seems to produce an Association (!) with nil as a key and the
symbol #Point as a value. Sending new to the symbol produces the error.
Maybe there are changes since 2.1 that I don't have?

(An Association?!!?? Where does THAT come from??)

The last two produce surprising results in that the error message appears
at the front of the workspace and the whole workspace flashes the selection
color momentarily. There is some odd bug somewhere.

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