nil or #nil?

Tim Olson tim at
Wed Aug 26 13:42:22 UTC 1998

Maurice Rabb writes:

>I agree with this.  I find it "least astonishing" for a literal array to
>mean an array that can be built with things that are known at compiler
>In my mind this should also work:
>#((65+2) $A (65 asCharacter) ('aString' size) (nil isNil))
>==> #(67 $A $A 7 true)
>because everything there is knowable at compile time.

The problem with this is that "knowable at compile time" is a slippery 
concept in Smalltalk.
Is (5 class superclass superclass) known at compile time?  If the 
compiler replaces this expression with Number, then later on when I 
change my image to add a super new whiz-bang class between Number and 
Integer, this code breaks.

(1 to: 5) could possibly be evaluated at compile-time to be the 
Interval(1 to: 5), but what about the expression "(1 to: 5) atRandom".  
How does the compiler know what messages have side-effects and what 
messages do not?

Smalltalk is so malleable that very little can be considered fixed at 
compile time -- that's one of its major strengths.

     -- tim

More information about the Squeak-dev mailing list