15 · Which language to build it in

15 · Which language to build it in

Babb

2026-11-23. The questions in order: how to code this as one repository, and in what language? Then alternatives to Rust, assembly, bash, Pascal, and finally: is Rust best, and how?


The requirements


babb-table/1
[["Requirement", "Implication"], ["A small, exact, trustworthy kernel reader", "Memory-safe, compiled, no hidden runtime"], ["Runs on servers, browsers and ZAKO devices", "Compiles natively, to WebAssembly, and to bare-metal targets"], ["Views must be provably pure", "A sandbox that enforces purity"], ["View methods pinned by hash", "A portable compiled artifact"], ["A web shell", "A web front end"]]
Requirement | Implication
A small, exact, trustworthy kernel reader | Memory-safe, compiled, no hidden runtime
Runs on servers, browsers and ZAKO devices | Compiles natively, to WebAssembly, and to bare-metal targets
Views must be provably pure | A sandbox that enforces purity
View methods pinned by hash | A portable compiled artifact
A web shell | A web front end

Recommendation: Rust for the core, WebAssembly for views



  • One kernel crate everywhere. A no_std crate compiles natively, to WebAssembly and to microcontrollers. The browser validates with the same code as the server.

  • The type system enforces the design. Exhaustive matching over the 64 verbs and the phases; distinct types for addresses and IDs; decimals, never floats; Result for validation.

  • Append-only is part of the API. Log has append and read, and no update or delete methods.

  • Views run in wasmtime with no imports. No clock, randomness or network can be reached, so purity is enforced by construction. The module hash is the view's method.

  • Exact bytes and exact arithmetic, fast folds with no GC pauses, and safe parallelism.

  • Tooling: cargo-fuzz for the parser, property tests for round trips and balance, Miri, benchmarks, generated C headers and JS bindings.


The costs: a learning curve, slower compiles than Go, and a smaller hiring pool.


The rest of the stack:
- TypeScript for the web shell;
- C through a thin interface for devices;
- the Python trial kept as a second, independent implementation, checked against the same conformance logs.


Alternatives weighed


babb-table/1
[["Option", "Verdict"], ["Go", "Fastest practical alternative. Simple, with wazero (WebAssembly in pure Go). But garbage-collected, binaries of several MB, and weak on small devices."], ["Zig", "Small, explicit, excellent C interop, which suits ZAKO. But pre-1.0 and a small ecosystem."], ["C", "Matches ZAKO and has the smallest footprint, but isn't memory-safe for parsing untrusted input. Suitable only for a tiny device reader."], ["TypeScript", "One language end to end, but slow, not for devices, and needs WebAssembly for purity anyway"], ["Python", "Fastest to prototype, and the trial exists; slow at scale. A good second implementation."], ["OCaml or Haskell", "Natural for folds and views; a small community"], ["C++", "Complexity without much gain here"], ["Assembly", "No. Not portable, unchecked, slow to write, and rarely faster than a compiler. At most a few measured hot loops on tiny devices, inside C or Zig. The real energy savings come from writing fewer bytes, not hand-tuned instructions. (WebAssembly is different: it's the format views run in.)"], ["Bash", "The interface, not the engine. Good for CLI glue, adapters, setup and quick awk/grep views on the readable form, which the canonical line is designed to allow. Unsuited to canonical bytes, exact decimals, binary forms, safe concurrent appends, sandboxing and scale. Two of the three v1 bugs were shell conveniences that broke guarantees: the in-place sort -o and the awk dedup key."], ["Pascal (Free Pascal)", "Readable, strongly typed, range-checked, and compiles to many targets, with a fitting lineage (Blaise Pascal's calculator). A good choice for a clear kernel reader. Weak for hosting views (no WebAssembly runtime of its own), and a small community."]]
Option | Verdict
Go | Fastest practical alternative. Simple, with wazero (WebAssembly in pure Go). But garbage-collected, binaries of several MB, and weak on small devices.
Zig | Small, explicit, excellent C interop, which suits ZAKO. But pre-1.0 and a small ecosystem.
C | Matches ZAKO and has the smallest footprint, but isn't memory-safe for parsing untrusted input. Suitable only for a tiny device reader.
TypeScript | One language end to end, but slow, not for devices, and needs WebAssembly for purity anyway
Python | Fastest to prototype, and the trial exists; slow at scale. A good second implementation.
OCaml or Haskell | Natural for folds and views; a small community
C++ | Complexity without much gain here
Assembly | No. Not portable, unchecked, slow to write, and rarely faster than a compiler. At most a few measured hot loops on tiny devices, inside C or Zig. The real energy savings come from writing fewer bytes, not hand-tuned instructions. (WebAssembly is different: it's the format views run in.)
Bash | The interface, not the engine. Good for CLI glue, adapters, setup and quick awk/grep views on the readable form, which the canonical line is designed to allow. Unsuited to canonical bytes, exact decimals, binary forms, safe concurrent appends, sandboxing and scale. Two of the three v1 bugs were shell conveniences that broke guarantees: the in-place sort -o and the awk dedup key.
Pascal (Free Pascal) | Readable, strongly typed, range-checked, and compiles to many targets, with a fitting lineage (Blaise Pascal's calculator). A good choice for a clear kernel reader. Weak for hosting views (no WebAssembly runtime of its own), and a small community.

babb-table/1
[["Priority", "Best"], ["Kernel correctness and safety", "Rust, then Zig"], ["Speed to version 1", "Python, then Go"], ["One codebase across device, server and browser", "Rust, then Zig"], ["Fit with ZAKO's C", "Zig, then C"], ["Hiring", "Go, TypeScript, Python"]]
Priority | Best
Kernel correctness and safety | Rust, then Zig
Speed to version 1 | Python, then Go
One codebase across device, server and browser | Rust, then Zig
Fit with ZAKO's C | Zig, then C
Hiring | Go, TypeScript, Python

The repository shape proposed


spec/       kernel.md, kernel.descriptor, conformance/
crates/ stream-kernel (no_std), stream-log, stream-codec, stream-pack,
stream-views, stream-books, stream-cli, stream-ffi
packs/ views/ shell/ adapters/ reference/python/ tools/lineage/

Rules that keep it honest:
- the kernel depends only on a hash function;
- every implementation runs the conformance logs in CI;
- built-in views use the same WebAssembly host as anyone else's.


The owner chose Rust, and the build followed (16).

Report Page