Trine Roadmap to 1.0
The single source of truth for progress. Tick an item only when its done-when is met and committed. Claude: read this file at the start of every session and update it as items finish.
Done (1.0) means all four bets are validated, the language is complete enough to write real programs, compiled code is benchmarked against C and Rust, and the tooling, interop and stability guarantees ship.
Status: 29 / 49 done · cross-cutting: 10 / 11 · all four bets passed · current focus: the quick first steps (breakdown table)
Execution order (revised 2026-11-26, after #16 review: "are speed, ease and safety holding up?"):
- Hardening: S6 sanitizer-backed native fuzzing → P4 one type check per build (compiler throughput) → #24 benchmarks v1 at realistic sizes.
- **#43 fast
trine run:** native by default, builds cached by content hash (today's default interpreter is ~8× slower than CPython on fib). - #17 maps and sets (done) → #21 capability-gated I/O (done).
- Speed plan (re-evaluation 2026-11-27, measured on generated C): P5 proven overflow elision (done) → step 2 typed data access (done: n-body 4.3× → 2.3× C; true unboxed layout #45 and #42 deferred until profiles demand them) (unboxed records, no constructor re-checks on single-variant types, typed list access; n-body 4.8× → ≤1.5× C) → #46 text + allocator (done: strings 5.6× → ~2.5× C, trees faster than C). Later: automatic profile-guided rebuilds in the run cache; parallel evaluation of functions that can't reach the outside world.
- #44 agent interface: JSON diagnostics, language card, formatter (#34).
- #18 modules.
Earlier orders (all done): P1 + S3 → #23 → #41 → #13 → #15 → #19 → #14 → #16. Rationale: bets 1–2 are measured as VM counts; real speed (and any meaningful schedule results) needs native code. The verifier now removes safety checks, so it gets fuzzed before native code depends on it.
---
Phase 0: Foundations
- [x] 1. Charter. Goals, three dials, pillars, four bets with kill criteria (
CHARTER.md). - [x] 2. Core syntax. Indentation lexer and recursive-descent parser.
- [x] 3. Type inference. Hindley–Milner, let-polymorphism by SCC, exhaustive match,
let/var. - [x] 4. Interpreter. Value semantics, copy-on-write, checked Ints, bounds checks, cost lens.
- [x] 5. Content-addressed store. SHA-256 of normalized definitions, rename detection,
.trine/. - [x] 6. Test harness. Golden outputs, error-message tests, hash-property tests.
- [x] 7. Golden programs v1. 7 programs (calc, hello, higher_order, matmul, primes, shapes, values).
Phase 1: The four bets
- [x] 8. Bet 1: ownership inference + refcount elision. Passed: 100% overhead removed on 6/7, 92.6% on matmul (
docs/BET1.md). - [x] 9. Golden programs v2. JSON parser, ray tracer, HTTP-style request handler. Done when: all run and are in the test suite.
- [x] 10. Re-validate bet 1 on v2 programs. Done when: ≥ 90% overhead removed on every program, or the report says why not.
- [x] 11. Drop-reuse (FBIP). Reuse freed constructor cells in place. Done when:
simplify-style rebuilds show frees+allocs converted to reuse. - [x] 12. Bet 2: refinement types + SMT. Z3-backed proofs of
0 <= i < len(xs). Done when: most bounds checks erased on golden programs at < 50 ms solver time per function (docs/BET2.md). - [x] 13. Bet 3: schedules. Separate schedule file for matmul (layout, tiling, vectorization). Done when: output is byte-identical and the speedup is measured (
docs/BET3.md). - [x] 14. Bet 4: hash store invisible to git. Done when: edit/diff/merge/review workflows are unchanged for a user who ignores
.trine/, and merges of renamed definitions are tested (docs/BET4.md).
Phase 2: Language completeness
- [x] 15. Generics on user types.
Option[a],Result[a, e], and?propagation. Done: generic types check and run identically in every engine, and the differential fuzzer generates them (docs/GENERICS.md). Monomorphization deferred to #19, where it first pays. - [x] 16. Records. Named fields, field access, update syntax. Done: named fields/args/patterns,
r.f,r.with(..); unique records (also nested, also list elements) update in place (docs/RECORDS.md). - [x] 17. Maps and sets. Value-semantic, with in-place updates when unique. Done (
docs/COLLECTIONS.md):{k: v},m[k],get,in,keys/values,set/add/remove/set algebra, insertion order, structuralKeytrait (Float keys rejected); in place in all engines; fuzzed. - [x] 18. Modules and imports. Visibility; the content-addressed store keyed per module.
- [x] 19. Traits / interfaces. Ad-hoc polymorphism (replaces the v0
Num/Ordhacks). Done: user traits + impls (incl. generic impls withwhere), inferred trait requirements, specialization at known types + run-time dispatch otherwise (docs/TRAITS.md). Follow-ups: user impls of operator traits, default methods, supertraits. - [x] 20. Effect handlers. Errors, generators, async, without coloured functions.
- [x] 21. Capability-gated I/O. No disk, input or environment without a grant. Done (
docs/CAPABILITIES.md):main(sys)gets the onlySys;Dircapabilities for granted directories only, narrowed bysubdir/readonly;.., absolute paths and symlinks refused;--allow-read/--allow-write/--allow-env, args after--; identical in all engines and the run cache;trine capsreads each function's reach off its type. - [x] 48. Unpack dying containers.
match o: Some(r) => ...whereodies at once: whenois unique, move its fields out and free only the cell. Done when:examples/text.trclears the bet-1 90% bar (was 77%). Done: 90%, test exception removed (docs/FBIP.md, update). The VM had modelled this ("drop specialization") all along, but native code didn't do it: the bet-1 tables credited compiled programs with an optimization they lacked. Nowcgen.rsimplements it (flat patterns), the VM uses the same conditions, and the VM no longer counts its borrowed aliases'Rcclones as references. fbip: −23% instructions natively. - [x] 49. String interpolation and characters. Done (
docs/TEXT.md):f"x = {x}, avg = {a:.2}"(parser rewrite to+/str/format_float, so engines and tools are unchanged; plain strings untouched, so JSON-heavy code keeps its braces),ord/chr. Decided against a separateChartype: characters stay one-character strings, as in Python, sincecharsreturning strings is relied on and the speed is already there (interned ASCII). - [x] 47. Capability-scoped packages. An imported module gets only the capabilities its importer passes it (needs #18). Plus network, clock, randomness and processes as capabilities.
- [ ] **22.
comptime.** The same language at compile time for generics and codegen.
Phase 3: Speed
- [x] 23. Native backend (pulled forward). Emit C from the ownership IR and compile with an optimizing C compiler; proven-in-bounds accesses become plain loads. Done when: all golden programs run natively with identical output. Cranelift for fast debug builds follows later.
- [x] 41. Type-directed unboxing. Carry checker types into the IR; unboxed
Int/Float,List[Bool]as bytes,List[Int]asint64[], no tag checks on proven-typed arithmetic. Done when: the sieve is within 2× of Rust (today 5.6×). Found by profiling #23: the gap is memory bandwidth from 16-byte tagged values. - [ ] 42. Small enums in registers. Return
Option[Int]/Result[Int, e]-sized values without a heap cell. Done when: the Option-returning search microbenchmark matches the sentinel version (today 52 vs 30 ms). Found by #15. - [x] **43. Fast
trine run.** Done (docs/RUN.md): cached native builds run before parsing (json 47 → 7 ms); a miss interprets at once and builds in the background; long first runs tier up to the native build mid-run by deterministic replay (fib(35) first run 19 s → 0.24 s); errors and exit codes identical to the interpreter. (Criterion revised: measurements showed native-by-default would make typical first runs 20× slower, sincecc -O2takes ~1 s.) - [x] 44. Agent interface.
--jsondiagnostics (location, message, fix), a one-page language card (docs/CARD.md, under 4k tokens), and machine-applicable fixes for the common errors. Done when: a scripted agent loop fixes the error-test corpus from JSON output alone. Done, with the done-when made precise (docs/AGENTS.md): every diagnostic has a stablecode;tools/agent_loop.py(JSON only) repairs all 17 static errors that have a mechanical fix (14 fully, 3 withtodoplaceholders); the other 10 static errors and 4 runtime errors need a decision about intent, which no script can make: they get code, position and message for a model or person. The card is ~2k tokens and every example in it is run by the tests. Also added:trine fix [--apply],todo("..."). - [x] 45. Unboxed record layout. Met (M5): nbody 1.48× C in the published run (field-wise access into flat lists, structs up to 8 Floats, plain counts without tasks;
docs/NATIVE.md). Records whose fields are all scalars stored as plain C structs (no tags, no per-field boxing; lists of them as arrays of structs). Done when:bench/v1/nbodyis within 2× of C (was 4.8×; 2.3× after speed step 2: no constructor tests on single-variant types, untested access to lists of heap values, changed-fields-only.withon reused cells; the rest is the tagged layout itself). Found by #24. - [x] 46. Text basics.
parse_int/parse_floatreturningOption,trim,starts_with/ends_with,format_float, fewer allocations. Done when:bench/v1/stringsis within 2× of Rust (was 3.6×) without hand-written digit parsing. Met: 1.5× Rust withparse_int(docs/TEXT.md); a small-object pool instead of small-string inlining (instructions 2.11 G → 1.04 G), trees now faster than C. Moved to #49:Charand string interpolation. - [x] 24. Benchmarks v1. Golden programs vs C, Rust and Python, published whatever they show. Done: 7 programs × 4 languages (+ Rust with overflow checks), identical outputs enforced, realistic sizes (
tools/benchmarks.py,docs/BENCHMARKS.md). Geometric mean: 1.80× C, 1.59× Rust, 11× faster than Python; nbody (records) and strings are the outliers (#45, #46). - [ ] 25. LLVM / MLIR release backend. Optimizing builds.
- [ ] 26. Tiered execution. Interpreter → JIT → AOT with one semantics; conformance tests across tiers.
- [ ] 27. Range-proven integers. Machine words where bet 2 proves the range.
Phase 4: Concurrency
- [x] 28. Structured concurrency. Scoped tasks.
- [x] 29. Isolation regions / actors. Data races don't compile.
- [x] 30. Biased / atomic RC. Atomic counts only for values that cross threads; re-run bet 1.
Phase 5: Tooling
- [x] 31. REPL. Types shown per line, hot reload. Done (basic):
trine replshows each definition's inferred type and each expression's value and type, keepslet/var/loops as a session, and rejects (without keeping) input that doesn't check or fails at run time, with errors positioned in what was typed. Works the same way the run cache does: the session is source text, replayed deterministically, showing only new output. Hot reload of files deferred to the language server (#32). - [x] 32. Language server. Salsa-based incremental queries, go-to-definition, inline errors.
- [x] 33. Ghost hints + cost lens in the editor. Inferred ownership, copies, refcounts, remaining checks.
- [x] 34. Formatter, linter, doc generator. Done (
docs/AGENTS.md):trine fmt(canonical, comment-preserving, refuses unless tokens are unchanged and the result is stable; all repository code already conforms),trine lint(unused variables and functions,varnever reassigned; codes and fixes like errors, applied bytrine fix),trine doc(Markdown with inferred types). - [x] 35. Package manager. Content-addressed dependencies, shared global build cache.
Phase 6: Interop, ecosystem, 1.0
- [x] **36. C FFI +
unsafeblocks.** - [x] 37. Python bridge. Call Python libraries from day one.
- [ ] 38. Self-hosting compiler.
- [x] 39. Language spec + migration tooling. Old hashes keep working; changes ship with automatic migrations.
- [x] 40. Trine 1.0 release. Stability guarantees, docs site, published benchmarks.
---
Breakdown into steps (2026-11-27)
Each remaining item split into steps that are useful on their own and fit one working session. Bold steps are the quick first steps, done in this order; the item is ticked when all its steps are.
| item | steps |
|---|---|
| 18 Modules | [x] **18a import "util.tr", names as util.parse · [x] 18b pub visibility · [x] 18c store keyed per module · [x] 18d fmt/lint/doc/caps across modules** |
| 47 Capability packages | [x] **47a trine caps per module · [x] 47b clock: now(sys) · [x] 47c randomness: seed(sys) + pure random(state) · [x] 47d processes, network (M2)** |
| 35 Package manager | [x] **35a trine.toml with local path dependencies · [x] 35b git dependencies by content hash · [x] 35c shared build cache** |
| 22 comptime | [x] **22a top-level const evaluated at compile time** · [ ] 22b compile-time reflection on types · [ ] 22c code generation |
| 27 Range-proven integers | [x] **27a prove * free of overflow** · [ ] 27b narrower storage in lists |
| 25 Release backend | [x] **25a --release (-O3) and --pgo (profile-guided)** · [ ] 25b LLVM backend for a subset · [ ] 25c full LLVM backend |
| P2 Faster interpreter | [x] **P2a the VM runs trine run's interpretation phase · [x] P2b remove overheads** (M5) |
| 26 Tiered execution | [x] 26a conformance suite: every engine, every example, one command · [ ] 26b in-process compilation of hot functions |
| 28–30 Concurrency | [x] **28a par_map(f, xs) for functions that can't reach the outside world** · [x] 28b scoped spawn · [x] 30 atomic RC for shared values · [x] 29 isolation checker |
| 42/45 Unboxed values | [x] **42a Option[Int] returned without a heap cell (native)** · [x] 45a all-Float records as C structs · [x] 45b lists of them as arrays |
| 36 C FFI | [x] **36a extern C functions on numbers · [x] 36b strings and buffers · [x] 36c unsafe blocks** |
| 37 Python bridge | [x] 37a a Python script as a capability, exchanging JSON · [x] 37b embedded calls |
| 32 Language server | [x] 32a diagnostics in the editor (LSP over stdio) · [x] 32b hover shows types · [x] 32c go-to-definition · [x] 32d incremental queries |
| 33 Editor hints | [x] 33a inferred types as inlay hints · [x] 33b ownership/copies/checks |
| 50 Iterables | [x] **50a Iter[e]: loops over anything iterable in generic code** |
| 20 Effects | [x] 20a design + effects in signatures (checked, not yet run) · [x] 20b generators in the interpreter · [x] 20c in VM and native · [x] 20d async |
| 38 Self-hosting | [x] 38a the lexer in Trine, checked against the Rust lexer · [ ] parser · [ ] checker · [ ] … |
| 39 Spec | [x] 39a syntax and type rules spec (from the card) · [x] 39b migrations via semdiff |
| 40 1.0 | [x] 40a release checklist + docs site generated from docs/ · [x] the release (1.0.0) |
Road to 1.0 (2026-11-28)
The objective: a new language on any platform. Programs that compile under 1.0 keep compiling and mean the same thing in every 1.x, on every platform. The same program prints the same output on Linux, macOS, Windows, WebAssembly (WASI and the browser), x86-64 and arm64, and the conformance suite proves it on each. The spec, the stdlib's names, the error codes and the command line are stable. It installs from a binary everywhere, and the published benchmarks are reproducible.
Why this is reachable: the compiler and the interpreter/VM are plain Rust (they run wherever Rust does, including wasm32), and native code is generated C (C compilers exist for every target). The work is a portable runtime, a toolchain story, and CI that runs everything on every target.
Not required for 1.0 (they can come in 1.x without breaking anything): a self-hosting compiler (38b+), an LLVM backend (25b/c), JIT tiering (26b), compile-time reflection (22b/c), narrower integer storage (27b).
| Milestone | Steps (in order) | Done when |
|---|---|---|
| M0 Any platform (first) | [x] P1 runtime platform layer (runtime/rt_platform.h: POSIX, Win32, WASI/no-threads): threads, thread-locals, atomics, clocks, limits, processes, dynamic loading behind rt_platform.h (POSIX, Win32, WASI, none); no compiler-specific builtins without fallbacks (MSVC) · [x] P2 toolchain discovery (trine toolchain: $CC, PATH, Visual Studio's Clang, LLVM; .exe names; zig cc with P3): cc/clang/gcc/cl/zig cc, .exe names, paths with spaces and backslashes · [x] **P3 trine build --target <triple>** (zig cc; Windows, macOS, Linux arm64/x64, WASI from Linux) · [~] P4 Windows (Clang: all tests pass on CI; still to do: conformance runner on Windows, sanitizers there, MinGW; MSVC cl can't compile the GNU-C output and isn't a goal) · [x] P5 macOS x86-64/arm64, Linux arm64 (all tests + 6-tier conformance on CI) · [~] P6 WebAssembly: WASI binaries done (--target wasm32-wasi: one thread; 68 programs identical on CI); the compiler builds as WebAssembly (every example on its VM and interpreter, CI); playground page written (playground/, published by pages.yml once GitHub Pages is on) · was: and a browser playground (the compiler itself built to wasm, running the VM) · [~] P7 CI matrix on real machines (GitHub Actions: Linux x64/arm64, macOS arm64/x64, Windows; tests + conformance): tests, 6-tier conformance, fuzz, sanitizers on every target · [x] P8 prebuilt binaries + installers (.github/workflows/release.yml on every published release: Linux x86-64/arm64 (glibc 2.35+), macOS arm64/x86-64, Windows x64 with a static C runtime; signed build attestations, SHA256SUMS; install.sh and install.ps1 refuse a checksum mismatch and are run against the real release on every platform; Homebrew formula and winget manifests generated per release, the tap and the winget submission are by hand: docs/INSTALL.md) | conformance is identical on the four desktop targets plus WASI, and the playground runs every example |
| M1 Language gaps | [x] **break/continue** (also if c: break / return x on one line) · [x] tuples + destructuring (let (a, b) = ..., for (k, v) in ..., tuple patterns and types) · [x] **string slicing s[a:b] + find/replace/lower/upper (and list slices) · [x] sort/sort_by/reverse, list +, tuple ordering (and tuple parameters) · [x] enumerate/zip (library functions written in Trine) · [x] math** (floor, pow, PI, ...; exponent literals) · [x] the tour's gaps: comprehensions, +=, g[r][c] = v, "-" * n, sum/min/max of a list, for c in s, print(a, b), f-string widths, range with a step · done 2026-11-30 | the "first hour" programs in docs/TOUR.md need no workarounds |
| M2 Standard library + I/O | [x] JSON parse/print in the stdlib (parse_json, to_json, to_json_pretty, accessors; written in Trine, src/std/json.tr) · [x] file append, line streams, stdin lines (append_file, open_lines/next_line, read_lines, each_line, stdin_lines) · [x] processes as a capability (47d) (run, run_input, --allow-run; no shell) · [x] network: TCP + HTTP client as capabilities (47d) (tcp_*, http, http_get, http_post, --allow-net; https:// via curl) · [x] time formatting (format_time, parse_time, time_parts, make_time, weekday; UTC) · done 2026-11-30 | a CLI tool, a log analyzer and an HTTP fetcher are short examples (examples/tools/: 99, 108 and 74 lines) |
| M3 Packages ✅ | [x] store keyed per module (18c) · [x] fmt/lint/doc/caps across modules (18d) · [x] git dependencies pinned by content hash + lock file (35b) · [x] shared build cache (35c) | a two-package project builds from a clean checkout, reproducibly |
| M4 Concurrency ✅ | [x] atomic RC for shared values in general (30) · [x] isolation checker (29) · [x] async/await over network capabilities (20d) | a parallel HTTP fetcher is race-free by construction and deterministic in output |
| M5 Performance | [x] bench/v1 in the regression gate (native; --instructions adds deterministic callgrind counts, 3% limit) · [x] field access into flat lists (wide records) (field-wise element copies, cold slow paths; structs up to 8 Floats) · [x] nbody within 2× C (1.48× in the published run; was 3.7× on this machine) · [x] P2b VM overheads (fib 44% fewer instructions, matmul 29%, particles 17%) · [x] published benchmark page with method (docs/benchmarks.html, docs/BENCHMARKS.md) · done 2026-11-30 | every number in the README is produced by one command (python3 tools/benchmarks.py; a test rejects any other) |
| M7 Tooling ✅ | [x] incremental LSP (32d) · [x] ownership/copy/check hints (33b) · [x] runtime errors with call stacks · [x] trine test (test blocks + runner) | an editor session on a 5k-line project stays under 100 ms per keystroke |
| M8 Interop ✅ | [x] C strings and buffers (36b) · [x] unsafe blocks (36c) · [x] Python embedded calls (37b) | calling zlib from C and pandas from Python are documented examples |
| M9 Stability ✅ | [x] spec freeze (SPEC.md 1.0) · [x] compatibility policy + edition field in trine.toml · [x] migrations via semdiff (39b) · [x] stable error codes and CLI | a test checks programs written against 0.9 still compile and behave the same |
| M10 Release (all but the outside reading) | [x] security review of the capability model: written threat model, adversarial review (sandbox_escapes_are_refused) · [ ] outside reading (needs a reviewer from outside the project) · [x] tutorial + tour + examples gallery · [x] repository: history, LICENSE, CONTRIBUTING, versioning · [x] 1.0 release notes, tag | the release checklist (docs/RELEASE.md) passes end to end |
Order: M0 first (so every later feature is born portable and checked everywhere), then M1, M2 and M5 together, M3, M4, M7, M8, M9 and M10. Platform rule from now on: a feature isn't done until it passes on every target in CI, or is explicitly marked unavailable there with a clear error (for example python() in the browser).
Cross-cutting: security and performance (always on)
These run alongside every phase. Each step on the main track must leave them no worse.
Security
- [x] **S1. No
unsafe.** The compiler and runtime contain zerounsafeblocks. Invariant: checked on every release. - [x] S2. Hostile-input limits. Nesting ≤ 256, operator chains ≤ 10,000, recursion depth ≤ 20,000: each fails fast with a clear error. Fixed a cubic type-checker blowup (depth 1,000 took 36 s; now milliseconds). Tested in
tests/hostile/. - [x] S3. Fuzzing. Random-program generator plus cargo-fuzz on lexer, parser, checker and VM. Done when: 1M cases run with no panics, hangs, or strategy disagreements.
- [x] S4. Resource limits for untrusted code. Memory cap and step/time budget (
trine run --max-mem --max-steps). Done (docs/SECURITY.md):--max-stepscounted identically by interpreter, VM and native code (tested on every example: equal counts),--max-time(all engines),--max-mem(native address-space cap; plainruncompiles first,--interp/--vmrefuse it),--max-output. Step counting is compiled in only when asked for (separate cached build), since it costs speed. - [x] S5. Threat model.
docs/SECURITY.md: what Trine guarantees (memory safety, no UB, no data races, capabilities) and what it does not. Done: guarantees with what backs each (by construction vs. by differential + sanitized fuzzing for the C side), the gaps table (resource limits, ungated stdout, the resolve-then-open race, side channels, trustingcc), the run cache's trust boundary, a checklist for running untrusted code. - [x] S6. Sanitized native code. The native fuzzer and golden tests also run under AddressSanitizer + UBSan. Done when: the native fuzz corpus runs clean under both, and it is part of
cargo test. Done:trine fuzz --native --sanitize [--release],TRINE_SANITIZE=1for builds; 1,600+ fuzzed programs (debug and release), all goldens, all bench programs and schedule fuzzing clean; part ofcargo test.
Performance
- [x] P1. Tracked baseline.
docs/PERF.mdwith timings for fib, json, raytrace, server on every release; regressions over 10% flagged by a script. - [x] P5. Proven overflow elision. The bet-2 verifier also removes Int
+/-overflow checks it proves can't fail (sign guards, bounded counters); erased operations re-validated by the VM and native debug builds, fuzzed at the edges, mutation-tested. Done: fib 41 → 9 ms (C: 20 ms); benchmarks geomean 1.80× → 1.54× C (docs/BET2.md). - [ ] P2. Faster interpreter. Make the slot-based IR VM the default runner (already 1.7× faster than the tree walker) and remove obvious overheads. Today fib(27) takes 0.16 s on the VM vs 0.04 s in CPython (4× slower).
- [x] P3. Native speed. Done when: benchmarks are within 2× of Rust. Met: fib(32) 1.2×, sieve 1.15× of
rustc -O, with overflow checks kept. Native is 9–21× faster than CPython. Caveat: only fib and sieve have Rust ports today; #24 adds ports of json/raytrace/server to keep this honest. - [x] P4. One type check per build. The pipeline (check → records → specialization → lowering → native) re-checks the program up to ~6 times; fuzz throughput fell 400 → 136 cases/s as features landed. Done when: each command type-checks once per specialization round at most, and a 5,000-line program checks in under 100 ms. Done: the check is passed through records → specialization → lowering → native;
checkruns 1 type check (a 4,400-line program checks in 38 ms),run --vm/build1 + 1 if records were lowered + 1 per specialization round (TRINE_PROFILE_COMPILE=1shows it). Finding: fuzz throughput is bound by the bigger generated programs, not by checks; native builds of large programs are bound by the C compiler (3.7 s for 53k lines of C), which is #43's job.
---
Log
| Date | Item | Note | ||||||
|---|---|---|---|---|---|---|---|---|
| 2026-11-26 | 1–7 | v0 built: ~3,200 lines of Rust, 7 golden programs, all tests green | ||||||
| 2026-11-26 | 8 | Bet 1 passed on overhead; raw ops 75–100% removed (frees can't be removed) | ||||||
| 2026-11-26 | 9 | Added json.tr (parser/printer, 6 KB round trip), raytrace.tr, server.tr (515 requests); all strategies identical | ||||||
| 2026-11-26 | 10 | Bet 1 holds: overhead removed json 91.3%, raytrace 99.3%, server 98.8% (json closest to the line) | ||||||
| 2026-11-26 | S1, S2 | Audit: zero unsafe. Found DoS: nested input hung the type checker (cubic). Fixed with shared type args + shallow unify; added nesting/chain limits and hostile-input tests | ||||||
| 2026-11-26 | 41, P3 | Typed IR + unboxed scalars + adaptive list storage (raw int64/double/byte) + depth counter in a register: sieve 118 → 23 ms (Rust 20), fib(32) 20 → 12 ms (Rust 10). New golden lists.tr; 3,000 native fuzz cases vs untyped VM clean | ||||||
| 2026-11-26 | 23 | Native backend: IR → C → cc -O2. All 11 golden programs identical natively with 0 leaked objects; 3,000 random programs compiled and compared with no disagreements. fib(32) 20 ms vs Rust 10 ms vs CPython 238 ms; sieve 118 / 21 / 483 ms (gap = 16-byte tagged values, so added #41). Range loops no longer build lists | ||||||
| 2026-11-26 | P1 | tools/bench.py + bench/baseline.json + docs/PERF.md: min-of-7 timing, confirmed-regression check (>10%). VM is 2.0–4.7× slower than CPython today | ||||||
| 2026-11-26 | S3 | trine fuzz: 1M differential program cases (6 engines each) + 1M syntax mutations, all clean after fixing 2 real bugs found by the fuzzer: a silent parser misparse after block expressions (hit 14% of generated programs) and a Perceus+borrow leak for f(x, x). Both are regression tests now | ||||||
| 2026-11-26 | 12 | Bet 2 passed: 99.97% of run-time bounds checks erased (75/84 sites), slowest function 24 ms, Z3 confirms 1,358/1,358 obligations; remaining 9 checks are genuinely needed. Fixed a 19 s analysis blowup and made the budget deterministic | ||||||
| 2026-11-26 | 11 | Drop-reuse + drop specialization: fbip tree allocs 12,286 → 1,033 (11,253 reused); json −914 allocs; never worse. Found and fixed undercounting of cascading releases; bet 1 re-measured, still passes on all 10 (min json 90.6%) | ||||||
| 2026-11-26 | 13 | Bet 3 passed: grid/sum kernels + separate .sched files (layout, order, tile, vectorize) with guarded specialization; 1,500+ fuzzed shape×schedule trials byte-identical to the interpreter (fuzzer found a double-reduction emitter bug, fixed). Matmul n=512: 3.75 s reference → 0.079 s with order i t j; vectorize j 4 (naive Rust 0.18 s). Side wins: borrowed-param element reads + lent closures, json bet-1 overhead 90.6% → 91.4%, kernels 50% → 100% | ||||||
| 2026-11-26 | 15 | Generic types + built-in Option/Result + ? (deferred Option/Result decision, type-checked early returns). New golden generics.tr, 6 new error tests; fuzzer generates generics and ? (100k cases + 1.5k native clean). Found and fixed: return inside a lambda left the enclosing function in the interpreter. Drop-reuse now handles rebuilds in both if branches (Koka-style tree insert: 37,654 nodes reused, allocs 39,889 → 2,235). Added #42 (small enums in registers) after measuring Option at 1.7× a sentinel in the worst case | ||||||
| 2026-11-26 | 19 | Traits: user traits/impls (generic impls with where), inferred requirements (insert : (Tree[a], a) -> Tree[a] where a: Ord, so #15's tree now works for Str/Float), specialization at known types (src/mono.rs) with dispatch fallback. Generic dot native: specialized 8.5 ms = annotated 8.2 ms vs dispatched 17.4 ms. 5 trait error tests; fuzzer generates traits (60k + 1.5k native + 30k syntax clean). Fuzz throughput 400 → 195 cases/s (bigger programs, re-check per specialization round) | ||||||
| 2026-11-26 | 14 | Bet 4 passed (all four bets now passed): self-ignoring, auto-maintained, corruption/failure-tolerant store; 24 checks in real git repos (tools/bet4.py): status/add/diff clean, rename-vs-new-caller merge explained by the store (area was renamed to surface, same hash), conflicts only in source, git clean -X/clone/branch switching fine. New trine semdiff: renames vs own-code vs dependency-only changes. Store upkeep ≈0.5 ms per check | ||||||
| 2026-11-26 | 16 | Records: named fields, construction by name, r.f (total: every variant must have the field), r.with(..), named patterns; lowered to match after checking (no engine changes). In-place updates: compute-then-rebuild order, nested p.with(v: p.v.with(..)) taken apart first, and new take element reads (ps[i] = f(ps[i]) moves the element out of a unique list). Particle sim: allocs 30,205 → 627, 150,000 reuses, 100% rc overhead removed; new particles bench 17× faster than mutable Python. Found: exhaustiveness false positive on nested single-constructor patterns, and silent untyped fallback when lowered code didn't check (now a hard error). 6 error tests; fuzzer generates records (70k + 2.6k native + 30k syntax clean) | ||||||
| 2026-11-26 | S6, P4, 24 | Hardening after the speed/ease/safety review. S6: ASan+UBSan on native code (fuzz debug + release, goldens, benches, schedules): clean. P4: one type check threaded through the pipeline (check: 2 → 1; run --vm: 5 → 4 on a 4.4k-line program, the rest are specialization rounds). #24: benchmarks v1 vs C/Rust/Python at realistic sizes: geomean 1.80× C, 1.59× Rust, 11× faster than Python; published gaps: nbody 4.8× C (record layout → #45), strings 5.6× C (text basics → #46). Fixes made on the way: scalar-aware drop-reuse, inline list fast paths, typed sqrt/float/min/max/str, borrowed local element reads, in-place string append (nbody 253 → 131 ms, strings 283 → 233 ms). Added the agent goal to the charter | ||||||
| 2026-11-27 | 43 | Fast trine run: content-hash build cache in the store (hit: 7 ms for json vs 47 ms interpreted), interpret-now + background native build on a miss, tier-up mid-run by replaying the native build and skipping already-printed output (fib(35) first run 19 s → 0.24 s), adaptive compile-first for files known to run long, native runtime errors re-rendered with source caret. Changed plan: native-by-default measured 20× slower for typical first runs (cc -O2 ≈ 1 s). Fixed tools/bench.py (its interp column had started measuring the cache); baseline re-saved on this machine instance after checking the v0.15 binary gives the same times here | ||||||
| 2026-11-27 | 17 | Maps and sets: map literals, m[k] / m[k] = v, get (Option), in (Map/Set/List/Str), keys/values, set/add/remove, union/intersection/difference; insertion-ordered (deterministic output, needed for tier-up replay); structural Key trait with a reasoned Float rejection; inference picks List/Map/Set from use. In place in interpreter, VM and native (C hash table, copy-on-write); golden collections.tr 99.3% rc overhead removed, 10,037 in-place updates; 6 error tests; fuzzer generates maps/sets (40k + 800 native + 300 sanitized + 20k syntax clean). New maps bench: 2.8× faster than CPython incl. startup (5.2× at 1M ops). One unreproducible failure of the schedule test (now pinned to --interp) recorded | ||||||
| 2026-11-27 | 21 | Capability-gated I/O. Authority is a value: main(sys) receives the only Sys; files only through Dir capabilities for directories granted with --allow-read/--allow-write, narrowed by subdir/readonly; --allow-env[=NAMES]; program args after --. Escapes refused (absolute, .., symlinks in names and intermediate directories; writes and reads O_NOFOLLOW); ungranted paths don't reveal existence. Sys/Dir can't implement traits, aren't keys, can't be compared, so a function's type bounds its reach: trine caps reports it. Same messages in interpreter, VM and native (C runtime parses grants from argv; the run cache passes them through); tier-up stops once a program has read input or touched files (replay would repeat effects). Security test (11 escape attempts × 3 engines + cached run), example capabilities.tr. Found: unistd.h clashes with the runtime's dup (renamed on include). Split the old #21 title: package scoping is now #47 (needs modules). Known limit recorded: resolve-then-open race (needs openat2), for S5 | ||||||
| 2026-11-27 | P5 | Speed re-evaluation, measured on generated C: fib's cost was overflow checks blocking GCC (55 → 19 ms without), n-body's was constructor re-checks (13%) and list access helpers (~35% of instructions), strings' was allocation (~45%). Did step 1: the verifier proves Int +/- can't overflow (sign facts, bounds by another Int or a length); erased ops are plain C, re-validated by the VM and TRINE_VERIFY_BOUNDS builds. Also proven indexes skip the range test in inline fast paths. fib 41 → 9 ms (2.2× faster than C); geomean 1.80× → 1.54× C, 1.59× → 1.33× Rust. Fuzzer gained sign-guarded edge arithmetic; two deliberately unsound rule variants were each caught within 3,000 cases. A first version cost 40% of fuzz throughput (proofs in every analysis pass); now only the final marking pass proves, over connected facts: no measurable cost. Rejected: wrapping (unsigned) arithmetic for erased ops: it loses GCC's no-overflow assumption (fib back to 55 ms) | ||||||
| 2026-11-27 | step 2 | Typed data access, from profiling n-body's C (the cost was checks the types already answer, not the layout): (1) single-variant constructor patterns are irrefutable: no tag/ctor test, no failure branch; (2) lists whose element type is a heap type use rt_index_o/rt_index_take_o/rt_set_index_o (no kind/storage test; storage asserted in debug builds), flagged on Index/SetIndex from new TypeInfo sets; (3) drop-reuse inside a known arm skips the kind test, and a same-constructor rebuild in the same block writes only fields that changed (scalar fields copied straight from the pattern, binding never reassigned). n-body 132 → 71 ms (4.3× → 2.3× C), particles 4.2 → 2.6 ms; geomean 1.54× → 1.40× C, 1.33× → 1.22× Rust. Fuzzer gained a single-variant record with scalar+string fields updated in place (partial .with, rebuild, swap). Mutation test: writing only fields without a pattern binding was NOT caught at first (records desugaring never binds replaced fields), so a field swap was added to the fuzz prelude; the mutation is now caught. 30k + 400 native + 200 sanitized fuzz cases clean | ||||||
| 2026-11-27 | 46 | Speed step 3 + text basics. Profile of strings: malloc/free ~31%, per-byte memcmp in split 7%, UTF-8 recounting 8%. Added a small-object pool (≤ 256 bytes; class kept in the object header's spare bytes, list buffers too; unique pooled strings grow in place within their cell), memchr-based split, known-ASCII pieces, 8-bytes-at-a-time counting, inline push and inline short string patterns. strings 2.11 G → 1.04 G instructions (~5× → ~2.5× C); trees 0.66× C (C pays malloc). Pool safety: off under ASan; debug builds poison freed cells (0xAB) so use-after-free becomes a fuzz disagreement. New built-ins with identical rules in all engines (src/text.rs): parse_int, parse_float, trim, starts_with, ends_with, format_float; fuzzed on edge values. Also: an element read that is a list's last use moves out of a unique list. Found: bet-1 bar fails on the new text.tr (77%): Option results that die right after matching cost a dup + drop per field → #48, with a documented test exception. Rejected: small-string inlining in the 16-byte value (touches every string path; the pool got most of the win). bench/v1/strings now uses parse_int (the #46 done-when): 1.5× Rust, 2.2× C. Benchmarks geomean ~1.1–1.2× C, ~1.0× Rust (noisy machine: runs gave 1.09×–1.23× C; a 135 ms n-body outlier in one run re-measured at 68 ms) | ||||||
| 2026-11-27 | 44 | Agent interface. --json on any command: one JSON object per error on stderr (file, line, col, kind, stable code, message, source line, fixes with line/col edits and a confidence: certain / likely / placeholder); check --json prints inferred types on success. Fixes are computed after the fact from the (test-pinned) message and the source, keeping the checker simple: typo → nearest name, let → var, missing match cases / methods / impls / fields → todo(...) placeholders (new built-in of any type), missing type parameter or where clause, named args on a function → positional in parameter order, ambiguous field/collection → annotate the parameter (alternatives), ? fixes (remove, change error type, return Option + wrap). trine fix [--apply]. Language card docs/CARD.md (~2k tokens; its examples are run by a test: writing it caught two wrong claims about get and sum). Scripted agent loop on the 31-program corpus: 14 fixed, 3 placeholders, 10 need decisions, 4 runtime. Rejected: a fix for impl-not-general (specialised impl heads aren't allowed, the first attempt produced a new error) | ||||||
| 2026-11-27 | 48 | Unpack dying containers. Investigation showed two measurement problems behind text.tr's 77%: (1) the VM's "drop specialization" (fields move into binders when an arm drops a unique scrutinee first) had never been implemented in native code, so bet-1 tables credited compiled code with it; (2) VM borrowed aliases hold Rc clones that native code doesn't, so drops that free natively were counted as non-final. Implemented the specialization in cgen (uniqueness tested once, s = u ? f : cpy(f), then free only the cell or keep it for reuse; flat patterns, borrowed scrutinee), restricted the VM to the same conditions (calc: 100% → 97%, its nested patterns had been credited), and made the VM discount aliases of the current and calling frames. text.tr 77% → 90%; exception removed; fbip −23% native instructions. Mutation test: binding without dup in the shared case was not caught at first (no fuzz program matched a shared value in an arm that drops it); added ospec/otake/orebuild to the fuzz prelude; now caught within 60 native cases | ||||||
| 2026-11-27 | 34 | Formatter, linter, doc generator. fmt.rs: line-based, keeps literals and comments verbatim, re-spaces by token rules (calls/indexes vs keywords, unary vs binary minus), re-indents by block depth (continuations one level deeper, which matched the existing code exactly), keeps aligned trailing comments aligned, one blank line between definitions; guarded: the output must lex to the same tokens and be a fixed point, or nothing is written. Every .tr file in the repository already passed --check; generated fuzz programs format cleanly. lint.rs: scoped walk for unused let/var, var never reassigned, uncalled functions (recursion doesn't count as a use); warnings reuse the diagnostic codes/fixes/JSON path. trine doc: file comment, then types/traits/impls/functions with comments and inferred types. Also verified #48 (found implemented in the working copy after v0.22): tests, native + sanitized fuzzing, and the mutation check (unconditional move in the shared case is caught within 60 native cases) | ||||||
| 2026-11-27 | S5 | Threat model (docs/SECURITY.md). Wrote down the trust boundary (program and its input untrusted; user, machine, cc, project folder trusted), four guarantees with their evidence (memory safety: Rust without unsafe + checks the verifier may only remove with re-validation; for the C runtime and generated code: differential fuzzing across engines, ASan/UBSan, mutation tests, stated as evidence not proof; capabilities; determinism; hostile source), and the gaps. Re-verified claims while writing (division by zero traps in all engines) | ||||||
| 2026-11-27 | S4 | Resource limits. Defined a step (a call of a user function or lambda, or one loop test including the final one; generated trait dispatchers don't count, so specialization can't change the count) and made the three engines agree: first attempt differed (interpreter skipped the final loop test, lambdas, early-exit for); fixed until every example and benchmark gave identical counts (only .sched kernel loops excluded). Native step counting first ran always-on and cost 7× on fib (a global decrement per call blocks GCC's recursion transformations) and 1.6× on sieve: now compiled only for runs that ask (TRINE_COUNT_STEPS, its own run-cache key; an executable built without it refuses --max-steps). --max-time (interpreter clock checks every 4,096 steps; native timed join), --max-mem (native RLIMIT_AS = current + limit; default run compiles first so the whole run is capped), --max-output. Code limit in JSON | ||||||
| 2026-11-27 | 49 | f-strings and characters. f"..." lexes into literal and expression parts (with :.N), and the parser rewrites to +, str, format_float: nothing downstream changed. Chose the f prefix over interpolating every string: json.tr and collections.tr build braces in plain strings. ord/chr in all engines (chr interns only ASCII: an early version interned every result, which would leak through the immortal table in a chr loop). The new example missed the bet-1 bar (43%): c = for.list[i] dup'ed each character the loop moved on. Fixed generally: a for loop's own list (owned, invisible to the program) now gives up each element as it's read (take), so example is at 100% and no example regressed. Fuzzer: f-strings and ord/chr; its first f-strings were rejected: {{ right after { is a literal brace (as in Python), so expressions starting with { need parentheses (documented) | ||||||
| 2026-11-27 | 31 | REPL. The session is source text (definitions + statements as main's body); an input is checked as part of the whole session, then run by replay, and only output beyond what was already shown is printed (determinism makes replay exact, the same idea as tier-up). Expressions are typed by making them main's result (() -> T), so no new checker API was needed. Errors are mapped back to the typed line and column. Blocks continue until an empty line; prompts only on a terminal, so scripted sessions are testable | ||||||
| 2026-11-27 | 18a/b | Modules. import "path.tr" [as name], pub fn/type/trait; name.thing for functions, types, constructors (also in patterns and named calls), traits and methods. A loader renames each module's definitions to <module>.<name> and merges everything before checking, so no later pass changed; only the parser (dotted names in types, patterns, impl and where) and value printing (constructors without the module) did. Spans: module k's lines start at k×10⁶, and Error::render maps them back to the file, so errors (including native runtime errors and JSON) land in the right file. The run cache key now covers every imported file (found by a text scan before parsing): without it a changed module would have run a stale build. Visibility errors say where to add pub; cycles show the chain; a local can shadow a module name | ||||||
| 2026-11-27 | 47a-c, 35a | trine caps adds one line per module (a module has no authority of its own; the line lists the functions through which an importer can pass some). Clock and randomness: now(sys) and seed(sys) need Sys (nondeterminism; they stop tier-up like input), while the generator is a pure SplitMix64 step, random(state) + random_below(state, n), identical in every engine (tested sequence), so seeded runs reproduce. Changed the step's shape from random(sys, seed): a pure generator keeps capability-free code able to use randomness deterministically. Local packages: a bare import "geo" looks up the nearest trine.toml [dependencies] (geo = { path = "../geo" } → ../geo/lib.tr); the run cache's import scan uses the same resolution | ||||||
| 2026-11-27 | 22a, 27a | Constants: const NAME = expr parsed as a zero-argument function; uses become calls, the program is checked, the interpreter evaluates each constant, and calls are replaced by the value as a literal (lists, maps, sets, constructors), then the functions are dropped: no later pass knows about constants (docs/CONST.md). Multiplication overflow: x * k proven when | x | ≤ 2^60/ | k | , x * y when both within ±2^31; added the fact that lengths are ≤ 2^44. Two bugs on the way: the first bound used MAX/ | k | , above the prover's 2^60 constant limit, so nothing was ever proven; and the length bound had to be restated per pass (facts recorded when a length was first seen belong to an earlier pass). Mutation (bound 2^62) caught by the fuzzer |
| 2026-11-27 | 25a, P2a, 26a | trine build --release (-O3) and --pgo (instrumented build, one training run with the given args and grants, rebuild with the profile); fib 8.9 → 3.7 ms, spectral 128 → 90 ms; the run cache stays at -O2 (compile time). The first phase of trine run is now the VM (1.1-2.2× faster than the tree walker; tier-up and step counting already went through the shared tick, so nothing else changed). tools/conform.py: every example, every error test and N generated programs on six tiers (interpreter, VM, VM+reuse, native, native debug with re-validation, release): 82 programs × 6 tiers, 0 mismatches. LTO from the plan dropped: the generated program is one C file, so there is nothing to link-time optimize | ||||||
| 2026-11-27 | 28a | par_map(f, xs): same result and same first error as [f(x) for x in xs] everywhere. Native builds run it on threads only when nothing can be observed: f a named function the compiler proves pure scalar (trine_fn_pure: every slot Int/Float/Bool or Unit-only, body only arithmetic/control flow/pure calls/math builtins, so no allocation and no shared state), an Int/Float list ≥2048, step counting off. A worker error longjmps out (thread-local hook in rt_error), results are discarded and the map reruns in order, so the reported error is deterministic. Collatz over 400k: 143 → 81 ms on 2 cores. Unit-typed statement slots first made every function look impure; fixed by allowing Any slots that only ever hold Unit | ||||||
| 2026-11-27 | 42a | One-field constructors with a scalar field (Some(3), Ok(2.5)) are immediate values in native code (T_IMM), not heap cells. All readers use CTOR_IS/CTOR_F/CTOR_ID, so cells (from older paths) and immediates mix; eq/hash/print agree. Compile-time choice when the field type is known, one tag test otherwise; unused reuse tokens are freed. Some(a / b)/None loop: 133 → 64 ms. Conformance 92 programs × 6 tiers clean; native fuzz 150 cases clean | ||||||
| 2026-11-27 | 36a | extern fn name(p: T, ...) -> R on Int/Float/Bool. The parser checks the types and that the symbol exists (dlsym in libc, dlopen'd libm: the Trine binary doesn't link libm itself, the first try found nothing) and turns it into a function whose body is #extern("sig", params), so checker, modules, Perceus and the verifier needed nothing new; the IR carries the signature in the builtin's name. Native: a direct call under an __asm__ alias. Interpreter/VM: one function-pointer type with 6 int + 8 float register slots fits every signature on x86-64/arm64. Authority: a C call could do anything (kill(pid, 9) is just numbers), so only an allowlist of pure libm math is free; other symbols need --allow-c (checked at call time in all engines, same output before the error), count as effects, and trine caps lists them as UNCHECKED | ||||||
| 2026-11-27 | 37a | Python bridge as a capability: python(dir, file) → Result[Py, Str] (file confined to the Dir like read_file, plus the --allow-python grant), py_call(py, name, args_json) → Result[Str, Str]. One driver script (sysio::PY_DRIVER), embedded by the compiler into native builds, so all engines speak the same protocol and give the same messages. Two-line requests (name as a JSON string, then the arguments) instead of one JSON object: with one object, argument text like [1], "fn": "other" could have overridden the function name. Native: fork/exec with a close-on-exec status pipe (exec failure reported at python(), like the interpreter), SIGPIPE ignored, process reaped when the Py cell is freed. Py joins Sys/Dir as a capability type in trine caps | ||||||
| 2026-11-27 | 32a, 32b, 33a | trine lsp: a dependency-free language server (own ~150-line JSON reader/writer, Content-Length framing). Diagnostics re-use --json rendering and parse it back, so the editor shows exactly the CLI's codes and messages; module loading got load_src (buffer text for the main file, imports from disk) and reset (module line numbers k×10⁶ would otherwise keep growing in a long-lived process and overflow u32 after ~4000 checks). The checker now records each let/var/for binding's type (Checked.locals), which drives hover (nearest binding above the cursor, else function or constructor) and inlay hints (after unannotated names; whole signatures at the end of unannotated function headers). Hover/hints use the last buffer that checked, so they survive half-typed lines. UTF-16 columns as LSP requires | ||||||
| 2026-11-27 | 20a | Effects design (docs/EFFECTS.md): outside-world effects are already capabilities, so only control effects remain, and they go in the signature. Generators: fn f(n) yields Int: + yield x; the type is (Int) -> Gen[Int], a plain value, which avoids effect polymorphism entirely (for accepts Gen[T]). yield desugars to #yield(e) (like extern, no new AST node, so no later pass changed) and is checked against a stack of the enclosing generator's yields T (lambdas push "none"). A stray yield gets a certain fix that adds yields T. run/build refuse generators with a clear message until 20b | ||||||
| 2026-11-27 | 38a | Self-hosted lexer: selfhost/lexer.tr (~330 lines of Trine) prints the same canonical token list as the new trine tokens (Rust lexer::dump). Identical on all examples, 17 corner cases covering every lexer error, 40 fuzz programs and its own source; the comparison is a test. Writing it surfaced two papercuts: no \r string escape, and an assignment can't be a one-line match arm (Some(e) => s = s + e must be a block). Floats are printed by the same formatting as str on both sides, so the comparison is exact | ||||||
| 2026-11-27 | 39a | docs/SPEC.md: lexical structure (with the layout algorithm), the full grammar in EBNF read off the parser (precedence levels, statement forms, patterns, desugarings), static rules (types, HM inference, operators, traits, values/records, capabilities, generators, modules), dynamic rules (evaluation order, Int never wraps, floor division, bounds checks, engine equivalence, limits) and the built-ins. Kept honest by a test: every keyword in the lexer's table and every built-in in the checker's table must appear in the spec, so adding a builtin without specifying it fails the suite | ||||||
| 2026-11-27 | 40a | docs/RELEASE.md: 13-item checklist, the first 7 automated by tools/release_check.sh (warning-free build, tests, 6-tier conformance, interpreter + native fuzzing, benchmark regression gate, examples formatted and lint-clean, site build). tools/site.py: dependency-free Markdown → HTML for README, ROADMAP and every doc, in reading order with shared navigation; .md links and bare CARD.md mentions become page links, and a dead internal link fails the build (a test runs it). Running the checklist's lint step found examples/records.tr defining an unused function; it is now used | ||||||
| 2026-11-27 | 20b | Generators run in the interpreter without threads or a CPS rewrite: a for over a generator runs the generator's body on the same stack, and yield v runs the loop body right there with the loop's variables swapped back in (a stack of handlers; the innermost is always the right one because yield can only appear directly in a generator's body). Since Trine has no break, the only non-error early exit is return in a loop body, which unwinds through the generator tagged with its loop's id. A generator value is the function plus its arguments (value semantics: each for restarts it). trine run uses the interpreter automatically for programs with generators; VM/native/build refuse with a 20c message. Bug caught by the step-limit test: the yield handler was popped before the step check, so a step-limit error inside a generator panicked on an unbalanced stack | ||||||
| 2026-11-28 | 20c | Generators in the VM and native code, as an IR lowering with no new ops. Inlined when the generator can't leave early and doesn't loop over a generator: its body is lowered in place in its own scope, and each yield lowers the loop body in the loop's scope (the interpreter's trick, done at compile time). A 10M-element loop takes 10 ms native, the same as range. General otherwise (stored or passed generator values, recursion, return): the call returns a closure over its arguments; the driver takes the loop body as a function and a state list [done, value, assigned vars...], which is moved through with take and updated in place. The first version rebuilt the list on every yield and copied the values out of it; that failed the bet-1 refcount bar on the recursive tree example (80.6% of rc overhead removed; it now removes 90.8%). Steps match the interpreter exactly, using uncounted drivers (a new trine_fn_uncounted table for native closure calls) and one-iteration loops as single steps. This also fixed an older bug: VM and native reported loop steps at 0:0, and now report them where the interpreter does (loop_span; while true gets a position too). Also fixed: --max-steps on native bypassed the scheduled kernels, which don't count lambda calls (kernels.tr counted 30 steps instead of 52). The fuzzer now generates loops over inlinable, recursive, early-returning and wrapped generators (400 + 150 native cases, clean). Generator examples moved to examples/, so conformance covers them on all six tiers (97 programs, 0 mismatches) | ||||||
| 2026-11-28 | 50a | Iter[e], a built-in requirement relating a container to its elements, carried as one type #Iter[c, e] so the existing machinery for generalization, instantiation and specialization handles it unchanged. A for over a value whose type is still unknown when inference stops used to default to List; now it generalizes: map : (a, (b) -> c) -> List[c] where a: Iter[b], and map/filter/fold accept Lists, Sets, Map keys and generators. At a call the requirement becomes a member constraint again, so it is solved together with indexing; the first version left it with the trait constraints, where it was solved too late, and fold(words, \"\", fn(a, w) => a + w[0]) stopped type-checking. Specialized copies loop at their concrete type: the IR lowering now reads the keys/#elements rewrite itself, since copies are made after records lowering. Unspecialized generic code decides at run time (#is_gen, then #iter_list), and the interpreter loops over Maps and Sets directly. Benchmarks unchanged | ||||||
| 2026-11-28 | 32c | Go-to-definition in trine lsp. The analysis now records every top-level definition (functions, externs, types, constructors, traits) with its file and line, mapping imported modules' synthetic line numbers back through modules::locate, plus each function header's parameters. Lookup order: the nearest let/var/for above the cursor, unless the enclosing function's parameter is nearer; then an exact top-level name; then alias.name, matched by its last segment. The result points at the name itself (looked up in the target file), not at fn/type. A test covers a function, constructor and type in an imported module, plus a local function, a loop variable and a parameter | ||||||
| 2026-11-28 | 45a | All-Float records (one constructor, ≥2 Float fields) are Repr::Rec, a C struct passed and returned by value, boxed only where a V is needed and unboxed on the way in (unbox_take releases an owned box, unbox borrows). An operand lent to a V-taking operation gets a box that lives for one line. Every place that used \"not Any\" to mean \"scalar\" now asks Repr::scalar(); Perceus too, which keeps the VM's reuse (the first version treated records as scalars there, and records.tr's allocations went from <1,000 to 60,629). The ray tracer at 1200×600 drops from 115 ms to 43 ms. Particles in a list first got 2× slower: every store allocated a cell, and take reads emptied the slot. A per-record set_index that refills the old cell when it is unique, plus reading takes in place, made it 15 → 13 ms. Closure captures and generator-driver parameters stay boxed. The fuzz prelude gained an all-Float record used every way (lists, .with, ==, match, closures, generic identity); the mutation checks (missing release of an owned box, missing drop of a temporary box) are caught by native fuzzing. Conformance 97 × 6 tiers, 400 + 200 native fuzz cases, and the sanitizer test are all clean | ||||||
| 2026-11-28 | 45b | Lists of all-Float records store fields flat: storage ST_R0 + k, stride N doubles, from per-record push_TR/index_TR/set_index_TR that compiled code emits when the element type is known. Everything else reaches elements through list_get, which generalizes the list to tagged storage once (boxing each element), so no generic runtime path had to learn the new layout. Only the two _o fast paths (object lists) needed a guard. Particles: 13 → 10 ms; the particles benchmark 2.8 → 1.9 ms. The fuzz prelude's record now covers shared appends, ==, in, printing and generic loops; it caught nothing in 45b, but the first 2,500-case run found a bug left over from 20c: a ? inside a loop body over a generator returned its Err value as the loop's state (the body is its own function in compiled code), so Try lowering now goes through lower_return. A regression test covers it | ||||||
| 2026-11-28 | 28b | Scoped tasks: spawn(fn() => ...) → Task[T], wait(t) → T. The meaning is sequential (as if each task ran at its spawn), which is what the interpreter and VM do. Native code runs tasks on threads and keeps that meaning: output goes into ordered segments, the first error in program order wins, and outside effects wait at a barrier. A task's captures are marked shared, with atomic counts encoded as rc <= -2, so the ordinary dup/drop fast path is the same single compare, and shared objects are never unique. Allocator free lists and live counts are per thread. Static rules: no capabilities or function values captured; Task never in signatures, nested types or lambda captures. Two fib(36): 155 → 78 ms. The fuzzer generates spawn / statements / wait with a printing task, and delays task starts (TRINE_TASK_DELAY_US), so order bugs can't hide behind timing. The mutation test (output bypassing segments) was missed until the task printed; now it is caught. ThreadSanitizer (TRINE_TSAN) found only a lazily-initialised setting (moved to startup) and is now clean on examples/tasks.tr. Conformance 98 programs, 800 + 200 native fuzz cases, benchmarks unchanged | ||||||
| 2026-11-28 | 45a fix | Regression found while assessing release readiness: bench/v1/nbody (7-field records) went from 107 to 292 ms after 45a/45b, because each one-field read copied the whole struct out of the list. The regression gate missed it because tools/bench.py doesn't run bench/v1. Structs are now limited to records of 2–4 fields: nbody is back to 108 ms, while the ray tracer (3 fields) stays at 49 ms vs 115 and particles (4 fields) at 10 ms vs 15. List literals of struct records are now built flat. Still to do: field-level access into flat lists (no whole-struct copy) would let wide records benefit too, and bench/v1 belongs in the gate | ||||||
| 2026-11-29 | M0 P1/P2/P7 | First real Windows build (the user's PC) and GitHub CI. Rust side: Windows versions of no-follow file opening and directory names; extern fn finds C functions with GetProcAddress over the C runtime DLLs and calls them through one function type per argument pattern (ffi_win.rs, generated; Windows x64 assigns registers by position); extern functions take at most 6 arguments on every platform. Runtime: everything from the OS now goes through runtime/rt_platform.h (threads, locks, condition variables, clock, sleep, CPU count, randomness, realpath with '/' separators, no-follow open, directory listing, the Python child process, --max-mem via RLIMIT_AS / a job object / an allocator budget on macOS, a portable --max-time join). Toolchain: trine toolchain; native builds find $CC, cc/clang/gcc on the PATH, then Visual Studio's or LLVM's Clang on Windows; -o name makes name.exe on Windows. Paths: names with a drive, a backslash or ':' are refused everywhere a Windows program could see them; LSP URIs with drives. examples/ffi.tr prints cbrt rounded (glibc's cbrt(27) is off by one ulp). Linux arm64 CI passes; Linux all green | ||||||
| 2026-11-29 | M0 P4/P5/P7 | CI is green on all five machines: Linux x64 and arm64, macOS arm64 and x86-64, Windows x64 (52 tests each; 6-tier conformance on the four POSIX ones). What the real machines found: macOS's dlsym default handle is -2, not NULL, and Mach-O names carry a _ prefix (native externs now use __USER_LABEL_PREFIX__); on Windows, C's stdout was in text mode (native output had \r\n; now binary), Git converted expected outputs to CRLF (.gitattributes pins LF), the CRT exports some POSIX names with _ (_getpid, _j0), and sanitizer builds can't start without Clang's runtime DLL (that test skips there). trine fmt keeps a CRLF file's line endings. The retired macos-13 runner was replaced by macos-15-intel | ||||||
| 2026-11-29 | M0 P3/P6 | trine build --target T cross-compiles with zig cc (found on the PATH or as the ziglang Python package): Windows, macOS arm64/x86-64 and Linux arm64/x86-64 executables build from Linux, and so does WebAssembly. WASI: the runtime's no-threads mode (tasks run at their spawn, par_map in order; setjmp is never needed), no signals or processes, 64 MiB of stack for the 20000-call depth limit, stripped. tools/wasi_run.py runs a build with wasmtime; tools/conform.py --wasi adds a seventh tier: all 68 programs (examples, error programs, generated ones) give identical output, exit status and first error. Two fixes it forced, both right everywhere: allowlisted math externs are called through their real C prototypes (labs takes a 32-bit long on wasm32 and Windows, and WebAssembly rejects the mismatched alias), and a name whose .. climbs above a granted directory is "outside the directory" whether or not the target exists, in all engines (it used to say "doesn't exist" for a missing one, revealing that). CI gained a WASI job and a cross-compiling job | ||||||
| 2026-11-29 | M0 P6 | The compiler itself builds for wasm32-wasip1 (no threads: main runs inline; extern fn math through a typed table linked from WASI's C library, ffi_wasm.rs, because a mistyped indirect call traps). CI runs all 27 examples on its interpreter and VM (54 runs, identical). The browser playground: playground/index.html (editor, examples, Run / Check types, VM or interpreter, a 20 s stop), a Web Worker, and wasi_shim.js, a small WASI host in JavaScript (in-memory files, captured output, clock, randomness). The shim is tested in Node against every example on CI, and here against WASI builds of Trine programs (file listing and reading included: output identical to the interpreter). pages.yml publishes it to GitHub Pages | ||||||
| 2026-11-29 | M1 break/continue | break leaves the innermost while/for, continue goes to its next round, in every loop: ranges, lists, maps, sets and generators; a block on the same line may now be break, continue or return x (if x < 0: break). The checker keeps them inside a loop of the same function (a lambda's body is its own: code outside-loop). Interpreter: Break/Continue signals; a break that leaves a loop body over a generator becomes Stop(id), which the generator's own loops let pass. IR: a new Continue op; for loops now move their counter on before the body, so continue is a jump to the top in every engine (no extra steps; i < end there, so no overflow). Generator loops: inlined ones lower continue to leaving the once-through body; a body with break isn't inlined; the general loop's state gets a broke entry, and a break skips the final "no more elements" step, as the interpreter does. Ownership: Continue takes the loop head's live set (the fixpoint already computed it), Break the set after the loop. Bounds: each continue is a back edge, so Houdini checks loop invariants there too. The fuzzer generates them (and prints loop variables, so a wrong exit shows in the output): two mutations (wrong live set for continue; inlining a generator loop with break) are caught. Found and fixed during fuzzing: continue in a generator body wrote the broke entry when the state had none. 52 tests, 101 programs × 7 tiers (WASI included), 2500 + 300 native fuzz cases, benchmarks unchanged | ||||||
| 2026-11-29 | M1 tuples | (a, b, ...) values, (Int, Str) types, (0, y) patterns, let (a, (b, _)) = e, var (lo, hi) = ..., for (k, v) in pairs:. A tuple of n elements is the constructor #Tn of a hidden data type type #Tn[a0, ...] = #Tn(a0, ...) that finish declares for each size a program uses (after modules are merged, so a tuple is the same type everywhere): checking, ==, map keys, set elements, patterns, ownership and native code all work unchanged, and only printing ((1, "a")), type names (swap : ((a, b)) -> (b, a)) and one exhaustiveness message are new. Destructuring is a parser rewrite: the rest of the block becomes the body of one flat match per tuple level, so the parts move out of a dying tuple (drop specialization handles flat patterns) and the refcount overhead is zero. Alongside: a same-line block may be an assignment (if x < lo: lo = x), yield (a, b) yields a tuple, and trine fmt keeps yields (Int, Int) spaced. Found by the bet-1 guard: m[k] = v copied its key and value into the map; they are now handed over (a new key is stored as it is): maps native 25.4 -> 23.2 ms. The fuzzer generates tuples (let/var destructuring, tuple loops, generators of tuples, ==, printing); a printing mutation (reversed order in the interpreter) is caught. 52 tests, 102 programs x 7 tiers (WASI included), 2500 + 400 native fuzz cases, ASan clean, no leaks | ||||||
| 2026-11-29 | M1 strings | x[a:b], x[:b], x[a:] on Strs (in characters) and Lists, strict like indexing (slice [2:9] is out of bounds for a string of length 5); find(s, sub) -> Option[Int], replace(s, old, new), lower/upper (ASCII letters only, so every engine and platform agrees). Slices are the hidden builtins #slice/#slice_from (a parser rewrite; a new built-in trait Seq = List or Str); rules in src/text.rs, mirrored in C (a list slice copies its storage in one go, flat numbers and records included). trine fmt writes xs[a:b] without spaces. The fuzzer generates non-ASCII strings, slices in and out of range, find/replace/case (and its own identifier renamer learned non-ASCII). Two older bugs found on the way. (1) A use after free (since borrow inference): in a loop whose body can leave after reading an element (return, and now break), the element borrowed from the list while the list was freed on that path before the element's last use; release builds read stale memory correctly by luck, native debug builds (freed memory filled) printed garbage. Fix: an element read with a break/return after it is taken or shared instead of borrowed (leaves_loop; the loop's own end test comes before the read and doesn't count). New regression tests run natively in debug mode with the leak check, and fail without the fix. (2) A data race ThreadSanitizer found while testing (1): dup/drop and the "unique, so update in place" checks read a shared object's count with a plain load while another thread changed it atomically; they now use relaxed atomic loads (RC_OF; free on x86/arm64). 52 tests, 103 programs x 7 tiers, 2500 + 500 native fuzz cases, TSan clean, benchmarks unchanged | ||||||
| 2026-11-29 | M1 sorting | sort(xs), sort_by(xs, key) (one key call per element, left to right), reverse(xs), xs + ys, and tuples ordered element by element (Ord holds for a tuple whose elements are comparable), so a tuple key sorts by several things: sort_by(people, fn((name, age)) => (-age, name)). Parameters may be tuples (fn((w, h)) => w * h, also in fn definitions). Both sorts are stable: Rust's stable sort in the interpreter and VM, a merge sort in C (Int, Float and boxed storage; -0.0 and 0.0 keep their order); a NaN is an error everywhere, as for <. sort_by goes through the same function-value path as par_map in every engine. xs = xs + [x] appends in place when xs is unique. Destructuring with let/for/parameters now binds the names in the pattern itself, so they can borrow from a tuple that stays alive (a loop over a list of tuples does no refcounting). The bet-1 guard gives sorting.tr a documented 85% floor (88.1% reached): its key function is called through a function value, which takes owned arguments (docs/FBIP.md limit 4). The fuzzer generates sorts by element and by tuple key, reverse, + and tuple <. 52 tests, 104 programs x 7 tiers, 2000 + 300 native fuzz cases, ASan and leak clean, benchmarks unchanged | ||||||
| 2026-11-30 | M1 enumerate/zip, math | enumerate(xs) and zip(xs, ys) are the first library functions written in Trine (parser::LIBRARY): added to a program that uses them and doesn't define them, they run like its own code in every engine (steps included; their spans are line 0, so docs, lint and the editor skip them). Math on Floats: floor ceil round (to Int; an out-of-range Float is an error printed in Trine's float format everywhere), pow (exact on Ints: 0, 1 and -1 bases are special-cased so a huge exponent can't loop; overflow and negative exponents are errors), exp log log2 log10 sin cos tan asin acos atan atan2 hypot; PI TAU E are replaced by literals unless the program defines them. Number literals take exponents (1e9, 2.5e-3) and _ in fractions, in both lexers (the self-hosted one is checked against the Rust one). The fuzzer generates them all. 2000 + 300 native fuzz cases clean | ||||||
| 2026-11-30 | M1 tour (M1 done) | docs/TOUR.md: 16 first-hour programs (hello, FizzBuzz, a table, word counts, primes, Fibonacci, sum types and records, Option/Result with ?, Game of Life, generators, statistics, text, files with a capability, functions as values, stdin, a Caesar cipher), each in docs/tour/ and run by a test on the interpreter, the VM and a native debug build (leak check), with stdin and flags from # input:/# run with: lines; the doc's copy must match the file. Writing them as a newcomer would exposed the gaps, all closed: list and map comprehensions (a loop pushing onto a hidden list inside a block expression, so ?/return act on the function); += -= *= /= %= (parsed from the existing tokens, so neither lexer changed; trine fmt writes them joined); g[r][c] = v (value, indexes, then the row is taken out, updated and put back: a take, so in place when unique); "-" * 20 and [0] * n (the checker decides repetition once the left side's type is known, deferring an unknown one; lowered to pushes, linear); sum(xs), sum(xs, start), min(xs), max(xs) (loops at the call site, so an empty list's error points there; a new #fail builtin); for c in s; print(a, b, c) and print(); f-string width and alignment ({x:>8.2}, #pad); range(a, b, step); same-line match arms with return/break/assignments. Negative indexes stay errors, now with a hint. A new example, comprehensions.tr, pins the rewrites (the differential fuzzer can't see them: every engine runs the rewritten program); the fuzzer also generates all of them. 53 tests, 105 programs x 7 tiers (WASI included), 3000 + 300 native fuzz cases, benchmarks unchanged (the VM numbers above baseline match the previous commit's on this machine) | ||||||
| 2026-11-30 | M2 (M2 done) | Library written in Trine (src/std/*.tr, docs/LIBRARY.md): groups (json.tr, time.tr, io.tr, enumerate.tr, zip.tr) added whole to a program that uses one of their names; a program that uses a group and defines one of its names gets a clear error; spans inside a group are numbered like a module (<library>/json.tr:LINE); trine caps/doc/lint leave library code out. JSON: a recursive-descent parser with line/column errors, full escapes and surrogate pairs, a depth limit; compact and pretty printers (integral numbers print without a fraction); Option accessors. Time (UTC): calendar from days (Hinnant), format_time with strftime codes, parse_time that validates dates and accepts Z/+hh:mm. I/O builtins in the interpreter/VM (sysio.rs) and the C runtime (trine_rt.h + rt_platform.h for POSIX, Win32 and WASI): append_file; open_lines/next_line over a new Lines capability; run/run_input (execvp/CreateProcess, no shell, both outputs read together so neither can block; --allow-run=prog); TCP over a new Conn capability (tcp_connect, tcp_send, tcp_read_line, tcp_read_all, tcp_close; 60 s timeouts; --allow-net=host[:port]); http (HTTP/1.1 over a socket for http://, curl for https://; chunked bodies, interim 1xx and proxy CONNECT replies skipped; methods, headers and URLs validated so a request can't be split; redirects not followed); eprint, exit(code) (exit statuses now pass through trine run --native too). Windows: ws2_32 linked; Windows builds cross-compile (not run: no Windows machine here). Language: opt ?? default (Option; lazy; both lexers and the formatter), the () pattern, \r escapes, yield in a same-line block, #T3 for builtins returning triples. Hygiene: generated code refers to builtins as #b.push and a pass renames a program's own variables or functions named push/len/range/keys/join/str/chars (a parameter called keys used to capture the keys(...) of a lowered for k in m). Examples: examples/tools/ (todo.tr, log_analyzer.tr, fetch.tr), json_library.tr, time_library.tr; tests/m2/io_ops.tr; a golden test runs the tools with grants, stdin, a local HTTP server and a TCP echo service (tools/test_server.py) on the interpreter, the VM and native debug builds (leak-checked). The fuzzer generates ?? and library calls. 54 tests, 107 programs x 7 tiers (WASI included), 1500 + 300 native fuzz cases, ASan/UBSan clean on the new C paths | ||||||
| 2026-11-30 | M5 (M5 done) | nbody within 2× C. Profiling the 7-field struct version (176 ms, slower than cells' 103) showed 442 M of 1.24 G instructions in memcpy: a 56-byte struct copy stays a library call. Flat-list element reads, writes and appends now copy field by field (the compiler keeps fields in registers and skips unused ones), and their slow paths (not flat, not unique, out of bounds) are noinline, cold functions; with both checks inline, small layout changes swung the time 2×. Programs without spawn/par_map define TRINE_ONE_THREAD, so reference counts are plain loads (a relaxed atomic load blocked register allocation across the loop: −12%). Structs now cover 2–8 Float fields. nbody: 103 → ~31 ms (C ~21–26 ms); raytrace and particles unchanged. P2b VM overheads: the stats counter copied its whole struct in and out of a Cell on every count (now in place); frames come from a per-function pool and arguments go straight into the callee's frame (no allocation per call); Int-with-Int arithmetic and comparisons skip dispatch and reference counting; closures called by sum/grid fill the frame directly; alias bookkeeping skips frames without aliases; a format! per list store is gone. Instructions: fib 1.83 G → 1.02 G, matmul kernel 3.37 G → 2.39 G, particles 3.25 G → 2.71 G; fib(27) 140 → ~90 ms (CPython 34 ms). Gate: tools/bench.py runs bench/v1 natively and, with --instructions, compares callgrind counts (deterministic; 3% limit) as well as times. One command: python3 tools/benchmarks.py measures bench/v1, bets 1–3, fast run, the VM against CPython and the card's size, and writes bench/numbers.json, docs/BENCHMARKS.md (method first), docs/benchmarks.html and every figure in the README (between <!-- n:KEY --> markers); a test fails on any other figure in the README. Regenerating corrected stale README claims: bet 1 is 100% on 5 of 7 programs (lowest matmul 95.7%), not 6 of 7 | ||||||
| 2026-12-01 | M3 (M3 done) | Git dependencies (35b): name = { git = "URL", rev = "tag, branch or commit" } in trine.toml. The first build resolves rev to a commit through a bare mirror in the shared cache, checks it out (no .git, core.autocrlf=false) into pkgs/<content hash> and pins (git, rev) -> commit, hash in trine.lock beside the root manifest; dependencies of dependencies go into the same lock. Later builds use the locked commit whatever the tag says now, and refuse files whose hash differs ("history was rewritten"); --locked (or TRINE_LOCKED=1) refuses to add entries; trine update [names] re-resolves and reports what moved. Messages name package files shapes@v1/lib.tr, not cache paths, and no cache path reaches the generated C. The content hash is sha256 over sorted relative paths, lengths and bytes (hidden entries skipped). Shared build cache (35c): $TRINE_HOME, else %LOCALAPPDATA%\trine / $XDG_CACHE_HOME/trine / ~/.cache/trine; native builds are keyed by the C source, the runtime headers, the compiler (path and --version) and its flags (not the build or output paths), so any project's identical build is a copy (TRINE_NO_BUILD_CACHE turns it off; PGO builds skip it). Store per module (18c): module definitions are keyed path:name relative to the project root (modules/geometry.tr:area, shapes@v1/lib.tr:area), library definitions are left out, name lines accept those keys, and rename hints work through module-qualified names (also for the loader's "module has no x" error). Tools across modules (18d): fmt formats/checks the project's imported modules, lint warns in them (including private functions never called) but not in packages or the library, doc adds a section per module with its public definitions; caps already covered modules. Done: a golden test makes two git packages (one depending on the other, one with a module of its own) and an app, builds and locks it, moves the upstream tag, clones the app into a clean checkout with an empty cache and builds --locked: same output, byte-identical executable, lock untouched; a forged lock hash is refused, an empty lock under --locked is an error, trine update follows the tag; store keys, fmt, lint and doc are checked on the clone. 56 tests, 107 programs x 7 tiers (WASI included), fuzz clean | ||||||
| 2026-12-01 | M4 (M4 done) | **async fn / await (20d):** calling an async function evaluates its arguments, then starts the body as a scoped task (spawn(fn() => f(args)), a rewrite after modules are merged, asyncs.rs) and gives a Task[T]; await t is wait(t). No colouring: async bodies are ordinary blocking code. An async function can't be used as a value, be a generator, or be main. A list of tasks is now allowed ([fetch(n, u) for u in urls], then await each); tasks still can't leave their function or hide in other types. **Net (M4):** net(sys) is the network part of Sys; http and tcp_connect take a Sys or a Net (a built-in Network trait). Isolation checker (29): a task's captures (and an async call's arguments) may be data, a Net, or a Conn/Lines (or a value holding one), which moves into the task: using it after the spawn, or taking one into tasks started in a loop, is an error (isolation.rs; also through an async call's argument temporaries). A Sys, Dir, Py, function value or task is refused with a reason (files could race, ...). With value semantics (no shared mutable memory) that leaves nothing two tasks can race on. New error codes task-authority, task-moved, async-as-value and five corpus programs. Runtime: on a task's thread, the operations a task can hold don't wait for other tasks (the main program's capability operations still do), so network I/O in tasks overlaps; exit(n) with tasks about happens in program order, like an error (status kept). Atomic RC in general (30): par_map runs any function on all cores when no capability is reachable from f or the list (checked at run time: authority only travels in capability objects): one chunk per core as a task, the list and f shared (atomic counts) first, everything a chunk creates plain and moved to the caller; output in list order, first error deterministic. Tasks gained chunk jobs (rt_task_new/rt_task_start). Done: examples/tools/fetch_all.tr fetches URLs with async fn fetch(n: Net, url); a golden test runs it against the local server (five 300 ms pages, a fast one, a 404, a refused connection) on the interpreter, the VM and a native debug build (leak-checked) with task delays 0/50/150 ms: identical output every time, and natively the five slow requests overlap (well under 1 s against 1.5 s). TSan clean on fetch_all and the par_map program. examples/async.tr (async + par_map over records and closures) is in the 7-tier conformance; the fuzzer generates async calls, lists of tasks and par_map over printing closures. Bet 1 re-run: every example still clears 90% | ||||||
| 2026-12-02 | M7 (M7 done) | Incremental LSP (32d): measured first (tools/lsp_bench.py: a generated 5k-line project, a main file and four modules, typed into a key at a time; full check ~50 ms: load 25, lint 13, check 22). Now: each file's parse is cached by content (and module number, with the tuple sizes it asked for); the checker reuses the module functions' types while the modules' fingerprint (paths + texts of every non-main file) is unchanged, skipping their bodies (types::check_incremental; a module can't see its importer, so its types can't change); only the open file is linted; messages are read on their own thread and a burst of changes to one document is checked once. Also for every load: library groups parsed once per process, and one walk for the names a program uses (types::names_used) instead of a walk per library name. Result: ~3 ms typical, ~20 ms worst per keystroke (diagnostics + inlay hints) on the 5k-line project; a test holds the p95 under 100 ms. A module edited on disk is picked up at the next keystroke (tested). Ownership/copy/check hints (33b): trine hints f.tr reads the final IR (Perceus + borrow inference + drop-reuse + the bounds verifier): borrowed/owned heap parameters, share (an rc increment of a named heap value), may copy (an update of a value shared earlier in the function), bounds check (index checks left; --overflow adds overflow checks); the server runs it in another process once the buffer is still for 300 ms and asks the client to refresh inlay hints. Call stacks: runtime errors print in f` and called from g at file:line:col (runs of one call counted, at most 12 lines), with stack in --json. In the interpreter and VM an error collects the call sites it unwinds through, so calls that return cost nothing (a first version recorded every call and the VM gate caught +11% instructions on fib; the error type is boxed for the same reason); native debug builds keep rt_cs[depth] per call and get the depth from the error's column (col | dp << 16), and print the same text from a generated table of function start lines and module paths. Release native code leaves it out: the store per call stopped GCC reshaping recursion (fib 6 -> 45 ms, instructions x8), which the benchmark gate caught. Native errors in modules now print the module's path and line (they printed main.tr:1000002). trine run re-renders native stacks (and JSON). **trine test:** test "name": blocks at the top level (checked with the file, never called, hidden from check/doc/caps/lint); assert(c[, why]) and assert_eq(a, b) are checks at the call site (assertion failed: 1 != 2); trine test [files/dirs] runs each test alone (VM by default, --interp, --native = one debug build per file with the test chosen by $TRINE_TEST), shows a failing test's output, error and stack, --filter, exit 1 on failure. **Done:** the 5k-line editor benchmark test, plus tests for incremental re-checking and hints over LSP, identical stacks on three engines, trine test on three engines, trine hints`. 62 tests, conformance, fuzz clean; bench instruction gate clean | |||||
| 2026-12-02 | M8 (M8 done) | C strings and buffers (36b): extern "z" fn ... names a library (dlopen libz.so.1 first, the name native code loads at run time, then libz.so; -lz for native builds, from /* trine-link */ lines in the C). New parameter types Str (const char *, a NUL-terminated copy; NUL inside is a runtime error), List[Int] (const uint8_t *, elements checked 0..255), var List[Int] (uint8_t *, written) and var Int (int64_t *); results Str (copied; NULL is an error) and Option[Str] (NULL is None). With var parameters the extern function returns (result, new values) and each call site is rewritten to assign them to the variables passed (externs.rs); a non-variable there is a type error. Every buffer gets 256 guard bytes (0xA5) checked after the call: an overrun is a runtime error, the same on every engine (16 weren't enough: glibc's heap check fired first on the interpreter). Interp/VM: ffi::call_args (pointers in integer registers); native: a generated wrapper per pointer-taking extern (trine_xw_*: conversions, guard checks, the result tuple). **unsafe: blocks (36c):** a statement; calls to externs that pass or return pointers are allowed only inside one (a type error elsewhere, and such functions can't be values). trine caps now marks every function that reaches unchecked C, transitively, with in an unsafe: block here (it used to say "computes and prints only" for a function calling C). Python objects (37b): py_start(sys) starts the bridge driver in an object-broker mode (--objects: import, attr, call with args/kwargs, item, value, json, str, free; objects kept by number, {"$py": n} passes one back); the library python.tr (Trine, over py_call + the JSON library) gives PyObj handles: py_import, py_get, py_invoke(_kw), py_method, py_index, py_value, py_ref, py_json (to_dict/tolist, NaN to null), py_text, py_free. A child process rather than libpython linked in: every engine and platform works the same, no Python build dependency, and Python can't corrupt Trine's memory. Done: examples/ffi/zlib.tr (version, compress, uncompress, crc32) and examples/python/pandas_report.tr (a DataFrame from Trine records, groupby, sums) are documented in FFI.md/PYTHON.md, and tests run both on the interpreter, the VM and native code (identical output), plus the checks: pointers outside unsafe:, a non-variable var argument, an overrun buffer, NUL in a string, NULL as None, Python errors as values, freed objects. Library group names are now read off the text (scan_names, checked against the parser in debug builds) instead of parsing every group at every load. Bench baseline re-recorded: matmul/vm had drifted +3.3% in instructions since M4 (M7's stack bookkeeping and code layout; M8 itself +0.5%), and the interpreter timings on this machine moved together; a boxed-str error message, tried to shrink Result, made it 6% worse and was reverted | ||||||
| 2026-12-04 | M9 (M9 done) | Spec freeze: SPEC.md is "The Trine language, version 1.0 (frozen)": changes only by adding or through an edition; new sections for contextual/reserved words (§1.4), C functions (§3.11), tests (§3.12) and editions (§6). Editions: [package] edition = "..." in trine.toml (editions.rs); editions 0.9 (the default for a file whose package names none, so old code compiles unchanged) and 1.0, which reserves async await test unsafe as names (they stay contextual keywords in 0.9). The rule is lexical, the same one the parser reads those words by (async before fn, await before a name or (, test at a line start before a string, unsafe at a statement start before :); after . and as a field name before : in a constructor/.with they stay allowed (field names show when a value prints, and dep.test may be another edition's function). --edition E for files outside a package; an unknown edition is an error naming the known ones; a file's parse is cached per edition. Migrations (39b): trine migrate [path] [--to E] [--check] rewrites every file of the package (reserved names get _, one choice package-wide so util.test follows fn test, avoiding names in use), builds a scratch copy of the package at the new edition (path dependencies made absolute), loads every file before and after and writes nothing unless every definition hashes the same under its old or new name (hashes ignore names, so this is semdiff's test), then sets the edition. A field rename was the first thing it refused (the type's hash changed, and so would its printed form), which is why fields stay allowed. Stable CLI and codes: a new usage text grouped by purpose, docs/CLI.md (every command, stable or internal), docs/COMPATIBILITY.md (what is stable: language per edition, hashes, names, CLI, JSON codes, file formats; what isn't: wording, performance, internals, bugs; editions; deprecation), trine version, trine new <dir> (a package at the latest edition with a test). A test checks usage text and CLI.md list the same commands and every diagnostic code is in AGENTS.md: it found three undocumented codes (yield-outside-generator, generator-returns, limit). Crate version 0.58.0. Done: tests/compat/0.9/ freezes the 35 examples, the 16 tour programs, a program using all four reserved words as names (with a test block) and a package whose module defines fn test, with their output and definition hashes as of 0.9; a test runs them on the interpreter and the VM and compares hashes, checks 1.0 rejects the names, and migrates copies to 1.0 with the same output and hashes | ||||||
| 2026-12-05 | M10 (1.0.0) | Security review: SECURITY.md rewritten for 1.0 (the authority M2-M8 added: run, net, Python, C, tasks, packages, the shared build cache; what each grant really gives: --allow-run, --allow-python and --allow-c are everything the user can do) and every boundary attacked again; the attacks are one test, sandbox_escapes_are_refused (.., absolute paths, symlinked file and directory, writes through a read-only grant, ungranted dir/env/run/Python/hosts over http and tcp, forged capabilities, a task capturing sys, C outside unsafe: and without --allow-c, a hanging constant), on the interpreter and native code. Found: a constant that never finished computing hung trine check and the language server (compile-time evaluation had no limit); constants now get 10 million steps (about a second), then a compile error, counted at the interpreter's existing every-4096-ticks check so it costs nothing per step. Written down as known gaps: HM type blowup on contrived programs, fetching a project's git dependencies when checking it (--locked stops it), the shared build cache's trust. The outside reading isn't done: it needs someone outside the project. Learning: docs/TUTORIAL.md (a word counter from trine new to a native binary: pure functions, tests, records, a module, capabilities); its finished project is in docs/tutorial/wordcount and a test runs it, compares the output the page shows and checks every code block on the page is in it. docs/GALLERY.md, generated by tools/gallery.py from each example's opening comment, by topic (four examples had none; now they do); a test keeps it current. Repository: LICENSE-MIT and LICENSE-APACHE (MIT OR Apache-2.0, "the Trine contributors"), CONTRIBUTING.md, CHANGELOG.md with the 1.0 notes, versioning policy in COMPATIBILITY.md, README opening for newcomers. Version 1.0.0, tag v1.0.0; the repository stays private (the owner's call). Release check: all 7 steps pass; one bench run flagged sieve/matmul native timing (+14-24%) with no instruction change, and an idle re-run showed none, so it was load on the shared machine | ||||||
| 2026-12-05 | 1.0 docs | SECURITY.md: "Cryptography and quantum computers" (no public-key crypto; SHA-256 safe; https via curl; post-quantum signatures planned for P8 releases) and a gap row: no cryptographic randomness. Found: seed(sys) silently falls back to the clock and process id when the OS source fails, and the interpreter on Windows always does (it reads /dev/urandom); documented, secure_random(sys) planned after 1.0. CAPABILITIES.md, CARD.md and SPEC.md say random is not for secrets. HANDOFF.md trimmed and the author email in the first commit replaced before the repository goes public | ||||||
| 2026-12-05 | security review 2 (outside input) | Aimed at AI-driven attack tools (ARTEX and the like), which find known kinds of weakness fast: everything that reaches Trine from outside a program read again, then attacked. Found and fixed: (1) a trine.lock commit like /../../x became a temp folder name, so trine check on a downloaded project made git write outside the package cache (confirmed on Linux; on Windows the delete before it could remove AppData): lock entries must be full hex commit ids and sha256: hashes; (2) a git URL starting with - was a git option (no command ran, by luck): URLs are https/http/ssh/git/file, scp-style or local paths, -- before them, protocol.ext/fd forced off, revs not options; (3) Windows native code found curl/python3 in the current directory first (a planted curl.exe would run): PATH only, as Rust does; (4) batch files granted with --allow-run passed arguments cmd.exe re-reads (BatBadBut): plain arguments only; (5) curl read ~/.curlrc (could follow redirects to ungranted hosts) and globbed URLs: -q -g --proto =https; (6) header names: RFC 9110 tokens (curl reads @name as a file); (7) the engines disagreed on six kinds of malformed HTTP response (found by a hostile-response fuzzer): one rule, CRLF-only head; (8) native request lines over ~690 bytes were cut short. Held: 4,800 fuzzed hostile responses under AddressSanitizer/UBSan, path sandboxing, run without a shell, the C compiler and FFI loading. The Windows fixes (3, 4) were only syntax-checked here: CI must run them. Test: hostile_inputs_are_refused_the_same_everywhere (69 integration tests); conformance 113 × 7 tiers clean; native fuzz 300 cases clean | ||||||
| 2026-12-05 | public; CI hardened | The repository is public (history scanned first: no secrets; the one personal email rewritten to a noreply address), with main protected (no deletion, no force-push), secret scanning with push protection, and private vulnerability reporting. CI now runs on every push to main and every pull request on all five platforms plus WASI, cross builds, the playground and a native fuzz job (150 cases, new seeds each run); workflows are read-only by default (Pages gives write only to the job that needs it), every Action is pinned to a full commit id, checkout keeps no token on disk, and Dependabot proposes Action updates | ||||||
| 2026-12-05 | first public CI: all green | The first run on every platform since M0 found three problems, each fixed: the playground (trine.wasm) didn't compile (CString was imported only for Unix and Windows; checked locally with conda-forge's wasm32 std, since this machine can't reach static.rust-lang.org); on macOS, Python's HTTPServer looked up its own name by reverse DNS and stalled past the network tests' 10 s wait (the test server now skips it; tests wait 30 s); on Windows, linkers stamp the build time into executables, so a clean checkout never built the same bytes (-Wl,/Brepro for MSVC-style linking, --no-insert-timestamp for MinGW). Run 2 (3a6944e): tests on Linux x86-64 and arm64, macOS arm64 and x86-64, Windows; WASI; cross builds; the playground; native fuzzing: all pass. The Windows runtime (including the second review's process fixes) now compiles and passes the suite on Windows | ||||||
| 2026-12-05 | P8: prebuilt binaries and installers | release.yml runs when a release is published (or by hand with a tag): builds the tag on five platforms (Linux x86-64 and arm64 on Ubuntu 22.04 for glibc 2.35+, macOS arm64 and x86-64, Windows x64 with +crt-static), checks Cargo.toml's version against the tag, smoke-tests each build, packs it with the licenses, README and changelog, records a signed build attestation (gh attestation verify), and attaches the archives, SHA256SUMS, trine.rb and three winget manifests (tools/package_manifests.py). A verify job then installs the published release on six runners with install.sh and, on Windows, install.ps1 under PowerShell 5.1 and 7, runs and natively builds a program, and checks that a wrong checksum installs nothing. install.sh: POSIX sh (tested under dash), curl or wget, sha256sum or shasum, Rosetta-aware, installs to ~/.trine/bin and only prints the PATH line. install.ps1: runs in its own scope (safe with `irm \ | iex: no exit, no leftover settings), adds its bin to the user PATH. Workflow build steps use the tag's source; scripts come from the workflow's commit, so v1.0.0 (tagged before them) can be built. Test: installer_checks_checksums_and_installs` (70 integration tests). Homebrew tap and winget submission: by hand, documented in docs/INSTALL.md | |||||
| 2026-12-06 | README for launch; website on Pages | README reordered for newcomers: pitch, a code sample, a "Why Trine?" table (speed, the four bets, least authority), install, trine new quickstart, a look inside, the language, the hash-by-meaning store, the repo map. Every figure, table cells included, is generated by tools/benchmarks.py (new short-form keys t_*; the README test now checks tables too, and caught a version number read as a measurement); the code sample runs on all three engines and prints what its comments say (readme_code_sample_prints_what_it_says, 71 integration tests). pages.yml now publishes on every push to main: the docs site, the benchmarks page and the playground under /playground/, with read-only build permissions (the playground-site branch push is gone) | ||||||
| 2026-12-06 | website: trine-lang.org, short top bar | The site is served at https://trine-lang.org (GitHub Pages, custom domain; README, Cargo.toml and the Homebrew and winget manifests point there). The 45-link sidebar became a top bar of eight (Playground, Install, Tutorial, Card, Spec, Docs, Benchmarks, GitHub) that wraps on phones, with every page grouped on a new docs.html. Fixed on the way: HTML comments (the README's figure markers, the tour's program markers) were shown as text; links to repository files that aren't pages (CHARTER.md, HANDOFF.md, the licenses) were 404s and now go to GitHub; the bets have titles. docs_site_builds_without_dead_links now checks the top bar on every page, that docs.html lists every page, and that no comment is shown | ||||||
| 2026-12-06 | Homebrew tap; winget manifests ready | brew install koongipaloongi/trine/trine works: the tap koongipaloongi/homebrew-trine holds the generated formula (description now within brew's style rules), and its workflow installs and tests it on macOS arm64 and x86-64 and Linux (all pass, brew style clean). winget: the three manifests (now with a trine moniker) validate against winget's 1.6.0 schemas; the pull request to microsoft/winget-pkgs is the owner's to open. A rerun of the release had changed the Windows zip's checksum, so the release workflow now refuses to replace a published release's files unless run with replace |