3: Syntax in a Nutshell
- Page ID
Squeak, like most modern Smalltalk dialects, adopts a syntax very close to that of Smalltalk-80. The syntax is designed so that program text can be read aloud as though it were a kind of pidgin English:
(Smalltalk includes: Class) ifTrue: [ Transcript show: Class superclass ]
Squeak’s syntax is minimal. Essentially there is syntax only for sending messages (i.e., expressions). Expressions are built up from a very small number of primitive elements. There are only 6 keywords, and there is no syntax for control structures or declaring new classes. Instead, nearly everything is achieved by sending messages to objects. For instance, instead of an if-then-else control structure, Smalltalk sends messages like
Boolean objects. New (sub-)classes are created by sending a message to their superclass.