smalltalk-pharo
Installation
SKILL.md
Smalltalk and Pharo
Pure object language where everything (classes, blocks, the IDE) is a live object. Sources: Pharo by Example, Enterprise Pharo, Spec UI Framework for Pharo, the Pharo cheat sheet, Reenskaug's 1979 MVC note, and Kay's The Early History of Smalltalk; paraphrased. Details in references/pharo-tooling-and-history.md.
Language in one table
| Concept | Rule |
|---|---|
| Messages | Unary x size, binary 3 + 4, keyword dict at: k put: v; precedence unary > binary > keyword, otherwise left to right |
| No operators/keywords | ifTrue:, do:, whileTrue: are ordinary messages to booleans, collections, blocks |
| Cascade | OrderedCollection new add: 1; add: 2; yourself sends all to the first receiver |
| Blocks | [ :x | x * 2 ] closures; evaluate with value: |
| Return | ^ returns from method; no ^ returns self (hence yourself for builders) |
| Variables | Temps | a b |, instance vars, class-side instance vars, globals start uppercase; self, super, thisContext pseudo-variables |
| Literals | #sym, 'str', $c, #(1 2 3), { 1+1. 2 } dynamic array, 1/3 exact fraction |
| Class | Everything is an instance of a class; classes are instances of metaclasses; class-side methods hold constructors (Point x: 1 y: 2) |
| Dispatch | Late-bound; doesNotUnderstand: is the fallback, so polymorphism replaces type checks |