Please send questions to
st10@humboldt.edu .
More Smalltalk details...
Smalltalk's character set:
* the "standard character set" [?] plus the twelve special characters:
# : ^ . ' | " ; ( ) [ ]
* it has the following tokens:
<identifier>, <number>, <string>, <comment>, <binaryOperator>,
<keyword>, <specialToken>
* <identifier> - like you'd expect, a name the programmer chooses,
and the naming tradition is camelCase: capitalsNotUnderscores
* <number> - like you'd expect;
* <string> - enclosed in single quotes! (like in SQL)
* <comment> - enclosed in double quotes
* <binaryOperator> - composed of 1 or 2 characters
* CAN vary between Smalltalk implementations!
* for reading purposes, pretty safe to assume that
any non-alphanumeric characters NOT in the special list of
12 above are probably a binaryOperator
* <keyword> - DIFFERENT connotation than you may have seen before!
* in Smalltalk, a keyword is JUST an identifier with a colon
at the end of it --- anyIdentifierLikeThis:
* a keyword, then, is ONLY special in the sense that it
forms a keyword message...
* <specialToken> - special characters used as separators for
parsing the language
# - begins a symbol literal #croak
: - ends a <keyword>
^ - ^answerThisObject (we'll use this in writing methods)
. - statement separator
' (single quote) - delimits a string literal
| delimits temp variables (block "parameters")
" - delimits a comment
; - for statement cascade (coming later...)
(
) - can be used to begin, end an expression
[
] - can be used to begin, end a block closure
* reserved words
...only five!
nil, false, true, self, super
nil - the value of any variable which has not yet been
initialized
OR has been forgotten
SHOULD be used to mean,
I have no idea;
Has never had a value;
IF it ever had a value, someone has since asked that we behave
as if it never had one; therefore, I have no idea
true
false - are singleton instances of classes True, False respectively
* are NOT literals of a class Boolean...
self - "refers to the object whose class contains the method
you are presently reading"
* "If the object's class has no such method, you must be reading
the nearest superclass which does have such a method"
super - refers to the SAME object as self,
both refer to the receiver
BUT the lookup for the method involved differs --
for super, as in Java, you start looking in the superclass
of the class for that method...
(super is a means by which the sender can OVERRIDE
its own defined method hierarchy)