reserved words?

Boris Gaertner Boris.Gaertner at gmx.net
Mon Nov 4 05:03:08 UTC 2002


Albert Wagner <alwagner at tcac.net> asked:
> 
> >does Smalltalk have any reserved words

Michael Vanier <mvanier at cs.caltech.edu> wrote:
> 
> self, super, nil, true, and false come to mind.  I'm not sure if they are
> technically reserved.  They are called "pseudovariables" in ST jargon.
They are write-protected. Also, you cannot define them as temporary
variables (e.g.  | self |). (Squeak tells you that these names are already defined)

> "true" and "false" are also pseudovariables, but they are singleton
> instances of class True and False respectively.  Similarly, nil is the
> singleton instance of class UndefinedObject.  So that just leaves self and
> super ;-)
There is one additional pseudovariable:  thisContext.
It is hardly ever used for application development, but it
comes into play when things like exception handling or
debugging are programmed. This is definitely something
for our bright stars.

You should also note that there are a few method names that
are given special treatment. These are

  ifTrue: ifFalse: ifTrue:ifFalse: ifFalse:ifTrue:
 and: or:
 whileFalse: whileTrue: whileFalse whileTrue
 to:do: to:by:do:
 caseOf: caseOf:otherwise:
 ifNil: ifNotNil:  ifNil:ifNotNil: ifNotNil:ifNil:

(All these are mentioned in MethodNode class >> initialize)

These messages are usually not sent, but inlined by the compiler. To
avoid strange errors, you should consider these message names as reserved.


Greetings, Boris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20021104/88f7d930/attachment.htm


More information about the Squeak-dev mailing list