writeonce/docs/stories/language-runtime-database/done/05-language-surface.md
shoney.arickathil 771180fd28 feat: iterations 19 + 17 — Float/Bytes scalars (.wob v5), library kind + internal/
- Float full stack: literals (fraction/exponent; `0..10` still a range), f64
  opcodes 34-41, @table column, WAL bit-exact replay, json fractions in and
  shortest-round-trip out. IEEE-quiet — FDIV never traps where DIV does.
- Bytes: a wo_str with its own class id, so alloc/free/copy are shared but no
  Text builtin accepts one; len/at/slice/eq/concat, base64 both ways, json
  boundary as base64; TEXT_COPY preserves the kind.
- No implicit Int/Float mixing (WO-E201 in the typechecker, not the emitter,
  which picks the opcode from one side and would misread the other).
- One IEEE deviation: float_cmp total order (NaN last, -0.0 == +0.0) for
  indexes and order-by, keys canonicalized to match. `?Float` nil is a
  reserved quiet NaN — the zero word is +0.0, WO_NIL_SCALAR's bits are -2.0.
- Renderer prefers fixed over exponential in 1e-6..1e21: pure shortest makes
  a price of 900.0 read `9e+02`. One renderer for interp/json/float_to_text.
- Fixed en route: lexer double-counted the leading digit; is_scalar_shaped
  took Float/Bytes as Int-shaped; Bytes ownership needed a shared heap-scalar
  predicate or temps never dropped; order-by bit-compared negatives backwards.
- Iteration 17: `kind = "library"` (absent = program; bad value = WO-E109),
  entry-less check mode retiring the `--emit` workaround, Go's `internal/` as
  WO-E108 at the consumer's `use`. Driver-only; VM/.wob/GC untouched.
- Framework reorg: internal/{parse,serve}.wo; http/form.wo split out to keep
  media_type/form_values public (parse.wo had grown public surface).
- Docs: link audit (97 -> 88 broken, conflict markers resolved, 2 duplicate
  stories removed), 00-code-review verified 26/27, iterations re-sequenced.
- Also carries the pre-staged pub(read)/using/#if work from the index.
- Gates: corpus 103/0, test_wal 156/0, web-app 26/0, oop-accept ALL MET.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 19:24:15 +02:00

69 lines
3 KiB
Markdown

# Iteration 5 — language surface (Haxe-parity adoptions)
> Format: fiberloom `product/story-iteration-template`. Part of
> [Story — one language, one runtime, one database, one binary](../00-story.md).
> **Status: ✅ COMPLETE 2026-08-20.** The *grammar* half landed 2026-08-14 —
> modules, `and`/`or`, interpolation, `const`, loop control, switch
> expressions, typedef records, enum payloads, try/catch, `nil`/`?T`,
> statics, `pub(read)` syntax, container literals, `for k, v in m`, `as`.
> The *strictness* half landed in three waves: `?T` forced handling
> (WO-E211/212/213 + narrowing) and reject rows (WO-E105) on 2026-08-18;
> the final three on 2026-08-20 (branch `language-surface-strictness`,
> developer directive overriding the post-12 park) — **`pub(read)` write
> enforcement** (WO-E219, class-owned writes, corpus-pinned),
> **`using` static extensions** (compile-time rewrite to a free-fn call,
> WO-E220 on method collision, zero owner/emit awareness), and **`#if`
> build flags** (`woc -D name`, token-level filter, WO-E003 misuse).
> `is`/`throw` stay cut (0 workload uses); `abstract` is a reject row.
> Plan 8 is closed.
## Goals
- The language grows from milestone grammar to a daily-driver surface: the
systems-track verdict table's every **adopt** row — switch expressions,
typedef records with `?fields`, `?T` optionals with null-narrowing,
enum payload variants, try/catch/throw over traps, `static` members,
`abstract` newtypes, `using` extensions, `use` modules, `is`, `pub` /
`pub(read)`, `#if` build flags, string interpolation, loop control.
- Every **reject** row (inheritance, `Dynamic`, `cast`, macros, FFI…)
refuses with a diagnostic citing doctrine — the language's boundaries are
as deliberate as its features.
## Acceptance Criteria
- What to achieve?
- **Given** the verdict table in the systems-track spec,
- **when** the corpus runs,
- **then** every adopt row has at least one golden fixture and one
must-fail fixture passing, and every reject row that would parse
produces its doctrine-citing diagnostic.
- What to achieve?
- **Given** a switch over a union missing one variant and lacking
`default`,
- **when** it compiles,
- **then** the diagnostic names exactly the missing variants.
- What to achieve?
- **Given** the three fenced VM changes (catch frames, variant objects,
boxed scalar optionals),
- **when** they land,
- **then** the format doc is updated in the same change and all prior
trap fixtures still pass byte-for-byte.
## Out Of Scope
- Stdlib modules and program mode (iteration 6).
- Any new VM capability beyond the three fenced changes.
## Info
- Normative table: `docs/superpowers/specs/2026-08-01-systems-track-design.md` Part 1.
- Order inside the plan matters: modules first (everything imports through
them), data shapes before optionals, rejects last.
## Proposed Solution
- Execute the existing plan: `compiler/plan/2026-08-01-haxe-parity-language.md`
(nine tasks, each shipping its fixtures and error-catalog entries in the
same task).