Strongtalk, re-built in Rust
The environment on this site is a new implementation of the Strongtalk virtual machine, written in Rust, compiled to WebAssembly and run inside your browser.
Starting from the original program
The starting point was strongtalk-r200.exe, a 32-bit Windows build of the original VM. Reading its
machine code gave the rules this edition follows:
| What | The original's rule |
|---|---|
| SmallIntegers | 30-bit values with a 2-bit tag, so SmallInteger maxVal is 536870911 |
| Float printing | %1.6f, then trailing zeros dropped, keeping one digit after the point (Float pi → 3.141593) |
| Failure codes | the VM's own list of 136 symbols (#OutOfBounds, #SmallIntegerOverflow, …) |
| Bit shifts | left shifts that leave 30 bits fail with #SmallIntegerOverflow; right shifts stop at 29 places |
| Not understood | a Message holding receiver, selector and arguments is sent with doesNotUnderstand: |
| Mandelbrot primitive | z starts at c, at most n − 1 steps, escape when x² + y² > 4 |
| Inlined messages | ifTrue:, ifFalse:, and:, or:, whileTrue:, to:by:do: and friends |
The exe contains only the VM. The class library and windows live in a separate image file that is not part
of it, so those were written anew for this edition, in typed Strongtalk source in the original's file-in
format (Delta define: #Point as: (...)).
How it works
- Parser for Strongtalk's syntax: Smalltalk-80 plus
<Type>annotations,{{primitive...}}calls andguaranteed. - Compiler to stack bytecode, inlining the original's control messages.
- Bytecode interpreter that keeps Smalltalk activations on the heap, so recursion can go hundreds of thousands of calls deep even in a browser.
- Class library of about 70 classes: numbers (SmallInteger, LargeInteger, Float, Fraction), collections, strings, streams, ANSI exceptions, points, canvases and turtle graphics.
- Type checker for the annotations.
- Environment: Launcher with Transcript, workspaces, class hierarchy, outliner class browsers, inspectors, error windows and picture windows. The VM runs in a Web Worker, so an endless loop never freezes the page and the Stop button can always interrupt it.
Your work is kept
Classes and methods you define in the environment are saved in your browser and come back when you return.
File › Download my changes saves them as a .dlt file you can file in again later.
Differences from the original
- No machine-code compiler: everything runs in the bytecode interpreter.
- No processes (
forkruns a block straight away). - A simpler type checker (class-based subtyping).
- A new class library and new windows, in the spirit of the original rather than copies of it.