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.
Values
- The workspace shapeThe smallest Smalltalk: temporaries, messages, Transcript.
- Temporaries and assignmentDeclare between bars, assign with :=, chain right to left.
- The three message shapesUnary, then binary, then keyword: the whole grammar.
Messages & blocks
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
- OrderedCollectionThe growable list that keeps arrival order.
- DictionaryKeys to values, with at:ifAbsent: reading safely.
- Set and BagEach element once, or counted every time.
- Arrays and intervalsLiteral #() arrays, lazy to: ranges.
Enumeration
- select and collectKeep, transform, find: the collection trio.
- inject:into:The fold: thread a running value through a collection.
- Collection statisticsmax, min, average, count: — collections answer themselves.
- Walking with styledo:separatedBy:, doWithIndex:, reverseDo:.
Strings
- Strings and symbolsStrings are collections; symbols are interned names.
- Characters$-prefixed objects with their own protocol.
- Splitting and joiningsubstrings splits on whitespace; streams rejoin.
Order & identity
- SortingasSortedCollection orders; the sort block chooses how.
- Associationskey -> value pairs, the atoms dictionaries are made of.
- Copying and identity= asks equal contents; == asks same object.
Streams
- WriteStreamBuild a string without repeated concatenation.
- ReadStreamWalk a collection with a cursor.
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.