# Sanguis Toolchain Changes

## 4.0 "Iteration:BigBang"

The first stable release of the 4.0 toolchain.

### New

- **Fleets use every core.** Long fleets are split among worker processes, with the same output, message order, errors and exit status as on one core. A fleet whose cells could affect anything outside themselves stays on one core. This replaces the 3.9 `bridge`'s threaded fleets.
- **`sanguis test`, `sanguis link`, `sanguis new` and `sanguis fmt`** are back from 3.9, with the `math` and `str` standard library and folder packages. Modules and tests are compiled side by side. `fmt` writes only if the compiled bytes stay the same.
- **Builtins from 3.9:** `now_ms`, `read_bytes`, `write_wav`, `step_divide`, `nn_gelu`, `nn_softmax`, `nn_argmax`, `nn_matvec` and `nn_layernorm`. Unset circuit inputs (`ext:name`) read as 0.
- **The circuit grids are back:** `wire`, `truth`, `trace`, `inspect`, `lint`, `vfmt`, `vana`, `grid`, `press`, `insert`, `play` (without a window) and `pulse` on circuit files. They run the 3.9 engine. A failed write now keeps the old file, and `grid` and `press` refuse to overwrite their source.
- **`sanguis pulse`** watches a source file and reruns it as you edit, only when the compiled program changes. Comment and formatting edits restart nothing.
- **`sanguis seal` and `sanguis prove`** write and check a receipt that ties a program to its source. Anyone can rebuild it and compare byte for byte, on either system.
- **`sanguis verify`** checks an install: every file against the manifest, the compiler and linker rebuilt from source, a test program and a native module.
- **`sanguis blob`** packs sys cells into a native module on both systems.
- **One command, one program.** `sanguis` is now a native program, the same on Windows and Linux. It finds its own files: no environment variables or wrapper scripts.
- **Linux needs no compiler.** gcc is no longer required. The command and floor are statically linked; the grid engine uses the GNU C library, 2.17 or newer.

### Fixed

- An organ method that uses `self` without listing it now receives the object, instead of stopping with "unbound slot 'self'".
- Stopping `sanguis` now stops the program it is running and any fleet workers.
- Damaged BloodCode could crash the floor in `grow_organ`, `grow_list` and `builtin`; it is now reported as damaged.
- `bleed` could delete the source file when the output named it.
- A failed build now keeps the previous output, and `drip` and `bleed` always report failure in their exit status. On Windows, folders with `(`, `)` or `&` in their names could report success.
- Windows: files and folders with non-English names now work.
- A source file starting with a UTF-8 byte order mark now compiles.
- Errors about missing files and folders name the real path.
- An empty source file is reported as such.
- Setup no longer clears the folder it installs into. It installs only into a new, empty or earlier Sanguis folder, and removing it deletes only what it installed.
- The Linux installer now stops when a file does not match its checksum.
- Editing your PATH keeps `%VARIABLE%` entries as they were.
- The seed checksum file matches the shipped compiler, and `verify` compares checksums instead of only printing them.
- The web floor is built from the same sources as the native floors.

### Changed

- The `sg`, `mkblob` and `smoke` commands and the batch and shell wrappers are replaced by `sanguis bleed`, `sanguis blob` and `sanguis verify`.
- Example programs, test drivers and the unused certificate bundle are no longer part of the toolchain download.
- The license is now VPL-1.1 (`LICENSE.txt`). Free use no longer includes internal business use, other than evaluation.
- BloodCode stays frozen at 29 instructions.
- The compiler seed changed (for the `self` fix); it rebuilds itself byte for byte.

### Different from 3.9

No just-in-time compiler: single-core numeric code is slower. Several things 3.9 let pass silently now stop with a message. The terminal interface, the game window and the graphics-card commands and builtins are not included. "Coming From 3.9" in the manual has the list.

## 4.0 line, before 4.0

- The toolchain became self-hosted: the compiler is a Sanguis program that compiles itself, running on a small C floor.
- Sys cells (`-> u64`, `-> i64`) with exact 64-bit arithmetic and typed memory, compiled to x86-64.
- Layouts, packed records, bit operations and the five cell roles.
- The floor builds as WebAssembly, so Sanguis runs in web pages.
- A call missing its `)` is reported at its `(`.
