In Smalltalk, there are 6 reserved keywords, or pseudo-variables:
nil
,true
,false
,self
,super
, andthisContext
.
They are called pseudo-variables because they are predefined and
cannot be assigned to. true
, false
, and
nil
are constants while the values of self
,
super
, and thisContext
vary dynamically as
code is executed.
true
and false
are the unique
instances of the Boolean
classes True
and
False
.
self
always refers to the receiver of the
currently executing method.
super
also refers to the receiver of the current
method, but when you send a message to super
, the
method-lookup changes so that it starts from the superclass of the
class containing the method that uses super
.
nil
is the undefined object. It is the unique
instance of the class UndefinedObject
. Instance
variables, class variables and local variables are initialized to
nil
.
thisContext
is a pseudo-variable that represents
the top frame of the run-time stack. In other words, it represents
the currently executing MethodContext
or
BlockContext
. thisContext
is normally not
of interest to most programmers, but it is essential for
implementing development tools like the Debugger and it is also
used to implement exception handling and continuations.