docs: Finch's self-hosting gap, as it stands

Sized numbers, methods, defer, errors as values and maps are now in the
self-hosted compiler; C import is the one piece left.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015f73FesGZGYPkmDvUcj6QX
This commit is contained in:
Nexoniarz 2026-10-25 18:55:31 +01:00
commit afb2e084af

View file

@ -59,28 +59,31 @@ Measured from the repository, not from its README alone:
## The self-hosting gap ## The self-hosting gap
"Rewrite it in Finch itself" is mostly done: `boot/` compiles itself. What it "Rewrite it in Finch itself" was mostly done before this was written: `boot/`
does **not** yet do is stated by its own test, `tests/boot.sh`, which skips compiled itself. What it lacked is stated by its own test, `tests/boot.sh`,
every test that uses a feature `boot/` lacks. Counting mentions in the two which skips every test using a feature `boot/` does not have. Measured against
sources confirms it (`boot/` vs `src/`): that test, on the branch `finish-finch` of the Finch repository (kept in the
author's checkout, `Projects/Finch`, as a branch on top of `embed`):
| Feature | `boot/` | `src/` | Needed for | | Feature | `boot/` | Notes |
|---|---|---|---| |---|---|---|
| maps | 0 | 185 | `codegen_map.cpp` (242 lines) to port | | sized numbers (`i8`..`u64`, `f32`), conversions | **done** | `int` and `float` stay the i64 and f64 defaults |
| errors as values (`or`, `try`) | few | hundreds | most real programs | | methods (`fn T.m`), mutation analysis | **done** | |
| methods on user types | 17 | 87 | partial | | `defer` | **done** | |
| `defer` | 2 | 31 | partial | | errors as values (`-> T!`, `error`, `try`, `or`) | **done** | including `fn main() -> !` |
| sized numbers (`u8`..`u64`, `i8`..`i32`, `f32`, `f64`) | none | throughout | kernel-facing code | | maps, `for k, v in`, `for i, x in` | **done** | |
| enums | 0 | 14 | | | `str(x)` of any value | **done** | |
| C import (`import "x.h"`, `link`) | none | `cimport.cpp`, 373 lines on libclang | **the way into every C library, SchOS's included** | | **C import** (`import "x.h"`, `link`, C structs by value) | **missing** | the one that matters for SchOS: libclang through Finch's own C import, then the System V struct ABI |
| target and ABI layer (AArch64, macOS, Windows) | 0 | `target.cpp`, `abi.cpp` | non-Linux-x86 targets | | target and ABI layer (AArch64, macOS, Windows) | missing | after C import |
| language server | 0 | `lsp.cpp`, 580 lines | editors | | language server | missing | `lsp.cpp`, 580 lines |
So "finishing" has a concrete order: **errors as values and maps first** (they The self-hosted compiler passes 17 of 22 tests and compiles itself to
are what the rest uses), then sized numbers and `defer`, then C import — which byte-identical output; the five it skips all import C. **C import is the next
needs libclang bindings, so it needs C import's own simpler form first — and piece, and the last one before the C++ compiler is only a seed.** It is a few
the target layer last. `tests/boot.sh` is the measure: the list of skipped thousand lines of Finch (`cimport.cpp` and `abi.cpp` are 740 in C++), done in two
tests shrinks to nothing. steps so each can be tested: functions, constants, globals and pointers first
(`cimport`, `c_pointers`), struct layout and the calling convention second
(`c_structs`).
The scratch files `note.txt` and `notatka.txt` in the repository are not The scratch files `note.txt` and `notatka.txt` in the repository are not
Finch's and can go. Finch's and can go.