Files
ww/CLAUDE.md
Hojun-Cho 99e3393048 lib/test: Go external-test packages (<mod>_test); retire decimaltest (#16 PREP-a)
30 lib test files: package <mod> -> <mod>_test, the sanctioned Go-over-Hare
departure (CLAUDE.md rule-9 carve-out; white-box testing deferred, not
forbidden). decimaltest retired per .ai/rob-16-decimaltest-ruling.md: Hare
ships no decimal_test.ha (engine covered transitively); coverage migrated
losslessly into stoftest rows (all-9s carry, nd>19 pure-decimal) + ftostest
f64_roundtrip mirroring ref/hare strconv ftos_test.ha tcsf64; k=0 micro-gap
documented at site. regex_test keeps its white-box internal probes under a
documented rule-7 divergence (rehome = task #9). 922_decimal_run + its 989
byte-id row removed with the fixture.
2026-06-10 12:11:11 +09:00

3.9 KiB
Raw Blame History

  1. This is a project for ww programming language
  2. ww is a programming language aiming for Hare + CSP, no GC
  3. cmd/ is the C bootstrap toolchain (wcc frontend lib, w6c/w6a/w6l per-arch, ww driver); selfhost/ is the ww reimplementation
  4. All C code must strictly align with plan 9 coding style
  5. lib/ is the standard library; follow Hare APIs (signatures, layout, error idioms) — consult ref/hare/ before designing new modules. Package declaration form is Go-style explicit package foo; and imports use import foo; (executables declare package main;) per language design (rob-pike + plan-9 sensibility); lib/ API surface still mirrors Hare.
  6. ref/hare and ref/plan9front are read-only references — consult before inventing data shapes or syntax
  7. No workarounds. If a bug forces a workaround, STOP and report with a precise repro. Document any retained divergence at the site with a pointer to the filed task. Never silent.
  8. Comments are WHY-only. Never narrate WHAT the code does — names carry the WHAT. Comment only non-obvious WHY: a constraint, a divergence from a reference, a citation to a filed task.
  9. Hare-fidelity over convenience. No ad-hoc extensions, renames, or convenience wrappers in lib/. Cite ref/hare// for every signature ported. Carve-out: the Hare _unsafe suffix convention is dropped wholesale (ww is C/Plan-9-lineage, an unmanaged systems language — no GC, no "safe" baseline to be unsafe relative to). bytes→str is a pure reinterpret (strings.frombytes, renamed from Hare's fromutf8_unsafe); validation is opt-in via utf8.validate(b)? at the IO source, never wrapped per-construction. Rationale: ref/hare/strings/utf8.ha:10,22 — the suffix flags Hare's managed-bytes-safety axis, which ww doesn't have. The honest name (frombytes) reserves fromutf8 for a future true validating helper. Carve-out: lib/ tests use Go's external-test-package idiom (package <mod>_test; + import <mod>;), a sanctioned Go-over-Hare departure — ww hard-rejects self-import (full Go), and Hare's same-package @test colocation has no ww analogue yet (in-package white-box testing is deferred pending tasks #5/#8, not forbidden). Rule 5/9 binds lib/ API surface, not test-authoring style. Ref: Go foo_test convention; task #16.
  10. Symmetric stages. cstage and wwstage MUST emit byte-identical asm for the same input. When inference power differs, align the richer side DOWN to the leaner side, not the other way.
  11. Split commits when they bundle unrelated concerns. Bisect-cleanliness is the default. Multi-fix commits need a body paragraph explaining why they couldn't split.
  12. Simple data, simple algorithms. Sea-of-stars style. Mirror Hare's structural choices over clever alternatives.
  13. No hardcoded size literals in size-computation contexts. Always route through the type table (tinfo.size / Type.size / ty_*->size / size(T) / primtypesize / tyslicesize). Per Drew's framing of Hare's discipline. make sizelint enforces and runs as a dep of make test. Exemptions documented inline with // sizelint-ok: <reason> (ww) or /* sizelint-ok: <reason> */ (C). Optional local enforcement: ln -s ../../tools/sizelint .git/hooks/pre-commit.
  14. Test targets. Inner-loop dev runs make test-unit (~3.8s, skips wwstage-driver tests: 950, 990997). Pre-commit / pre-push runs full make test (~8:30, all 132 incl. byte-id gates). The test target is the bootstrap-correctness gate — never push without it green. test-unit is a fast confidence check on unit-level code (stages, stdlib, smoke); a green test-unit doesn't prove bootstrap, only that the unit set is intact. Don't add new wwstage-driver tests outside the 950/990997 range (the test/run skip set is keyed by NNN prefix). Phase split background: ww_ww writes intermediates next to every traversed source (filed bug), so concurrent wwstage-driver tests would race on selfhost/cmd/<tool>/main.{s,combined.ww,o} fixtures.