The Image-Based Environment

2.1 The four files

A Pharo installation consists of:

VM (Pharo.exe, pharo, Pharo.app) Platform-specific virtual machine: executes bytecode, JIT-compiles, manages memory Image (Pharo.image)

A snapshot of the entire object memory: classes, methods, tools, open windows, your objects Changes (Pharo.changes)

An append-only log of every source change and expression you evaluated Sources (PharoXX.sources)

The source code of the base system as shipped (read-only, shared between images of the same version)

The image contains compiled methods; their source text lives in the .sources and .changes files, referenced by file pointers.

2.2 How it works

Saving the image writes all objects to disk. When you restart, everything is exactly as you left it — windows, inspectors, even running processes.

Not saving means losing changes in memory — but source changes are still in the .changes file and can be recovered.

┌───────────────── Pharo.image ─────────────────┐
            │ every object: classes, methods, windows, data  │
            └───────────────────────┬────────────────────────┘
                                    │ loaded into memory by
                             ┌──────▼──────┐
                             │     VM      │  interpreter + Cog JIT + Spur GC + primitives
                             └──────┬──────┘
                                    │ uses
                              Operating system (files, sockets, display)

Pharo.changes  ← every method you accept and every do-it is appended here
PharoXX.sources ← original source of the system (read only)

2.3 Recovering lost changes

If the image crashes before saving, use Epicea (Pharo's change log tool, *World menu → Tools → Code Changes*, or the "lost changes" dialog shown on startup) to replay changes recorded since the last save. Squeak and Cuis offer *Recover lost changes* from the changes file.

2.4 Image vs files: the modern workflow

The image is a working environment, not a source repository. Real projects keep source code in Git (as Tonel files via Iceberg, Chapter 28) and load it into a fresh image with Metacello (Chapter 29). Treat images as disposable: download a fresh image, load your project from Git with a baseline, work, commit, push — and throw the image away whenever it gets messy.

GNU Smalltalk is the exception: it is file-based like Python or Ruby — you write .st files and run them with gst (Chapter 41). It can also save images, but most people use it as a scripting language.