reserved words?

Stephane Ducasse ducasse at iam.unibe.ch
Tue Nov 5 06:45:37 UTC 2002


Object>>yourself

	^self


at least in VisualWorks


In VisualAge apparently this is the same but you cannot change the 
definition of yourself.

Ian Steinman reported during my first ESUG that he needed to change the 
definition during some project.

Stef

On mardi, novembre 5, 2002, at 12:03  am, Raymond wrote:

>
> Le 2002/11/04 à 06:03, Boris Gaertner <Boris.Gaertner at gmx.net> 
> écrivait:
>
>>
>> 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
>
>
> In this regard what is Œyourself¹ ....?
>
>
Dr. Stéphane DUCASSE (ducasse at iam.unibe.ch) 
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do
  different? ... especially if, by doing something different, today
  might not be your last day on earth" Calvin&Hobbes





More information about the Squeak-dev mailing list