typestar

Language basics

31 steps in 10 sets of Smalltalk.

Smalltalk is where objects came from: the language Alan Kay's team built at Xerox PARC in the 1970s alongside the GUI, the IDE, and the mouse-driven workflow it took the rest of computing decades to absorb. Everything is an object, everything happens by message send, and the entire grammar — unary, binary, keyword messages — fits on a postcard. Conditionals and loops are not syntax; they are messages booleans and blocks answer.

This tour types workspace Smalltalk, the way the language is actually written interactively: temporaries and cascades, the three message shapes, blocks and closures, ifTrue:ifFalse: and to:do:, the collection library from OrderedCollection through Dictionary, Set, and Bag, select/collect/inject, strings and symbols and characters, sorting with sort blocks, read and write streams, exceptions with on:do: and ensure:, exact fractions, and reflection as conversation — class, respondsTo:, isKindOf:. The Encore is the cross-language script trio spoken in Bags, blocks, and cascades under Pharo.

Start this tour

Values

Messages & blocks

  • CascadesOne receiver, many messages: the semicolon.
  • BlocksCode in brackets, a value until sent value.
  • Booleansand:/or: take blocks and short-circuit; & and | do not.

Control flow

  • ConditionalsNo if statement: booleans take ifTrue:ifFalse: messages.
  • Loopsto:do:, timesRepeat:, whileTrue: — all messages.
  • nilAn object like any other; ifNil:ifNotNil: branches on it.

Collections

Enumeration

Strings

Order & identity

Streams

Reflection

  • Asking objectsclass, respondsTo:, isKindOf:: reflection as conversation.
  • Exceptionssignal raises; on:do: handles; ensure: always runs.
  • NumbersFractions stay exact; integers grow without limit.

Encore

  • word_freq.stA word-frequency table from a Bag, a sort block, and padding.
  • grade_report.stReport cards from associations, a block ladder, and padding.
  • temp_stats.stA week of temperatures: inject-picked extremes, bars, swings.

The other Smalltalk tours