Help - Language - Squeak Semi-formally - 3.4

Previous -  Squeak Semi-formally - Next

3.4. Terms 4: Logical Constants

Now we finally arrived at the beginning of Squeak's processing. First, there are the all important:

pseudo_variable = "true" | "false" | "nil" | "self" | "super" | "thisContext" | "homeContext".

These terms are called "pseudo-variables" because they have on the one hand a variable meaning in variable  contexts (rather like pronouns in English) but on the other hand cannot be assigned a different content, as all variables can be in Squeak.

It need here only be note that "true", "false" and "nil" are used for logical processing, while "nil" is also used for assignments (see below). The "true" and "false" are Squeak's  Booleans, while "nil" is a very convenient addition to these.

Next, "self" and "super" are used to deal with Squeak's so-called inheritance, and basically instruct Squeak where to find certain methods (see below for methods).

Finally, "thisContext" and "homeContext" are used mostly internally by Squeak in the processing of blocks and other code, to keep track of what is where and belongs to what.

I noted above that "true" and "false" are Squeak's Booleans. These are implemented in Squeak in another way than in other languages, and these come with the  following:

special_keyword = "ifTrue:" | "ifTrue:ifFalse:" | "ifFalse:" | "ifFalse:ifTrue:" | "whileTrue" | "whileTrue:" | "whileFalse" | "whileFalse:" | "and:" | "or:" | "to:do:" | "to:by:do:".

Except for the last two, all of these are used for dealing with logical alternatives and possibilities, while the last two are used for passing parameters.

Three remarks should be made: 

First, In Squeak, the colon ending a term is used to indicate that a parameter follows. In the case of terms dealing with Booleans, these often are blocks (more of which below).

Second, there are some more terms in the category special_keyword, namely the Booleans involving nil, such as "ifNil:". In general, it seems not completely clear at present what is counted as belonging to the very basis of Squeak, and what doesn't, and one reason is that in fact the logical processing in Squeak is somewhat differently implemented from other languages. 

Third, in fact the operations indicated by these keywords are normally optimized/inlined by Squeak into tests and jumps and are not sent as actual messages. This happens for speed reasons, and because these tests and jumps are quite simple and very universal. However, you can have the effect of ordinary messages (useful for debugging) by using 

#perform:, #perform:with:, #perform:with:with:, and #perform:with:with:with:.

This is another series of special_keyword. (Not recommended, unless you are debugging.) The "with:" etc. is a general way to pass 1, 2 or 3 parameters in Squeak.

Previous -  Squeak Semi-formally - Next