WhatsNew + roadmap: mut-local milestone closed; Stateful-islands marked in-progress

- docs/WhatsNew.md: append a user-facing entry describing the new
  local-mutable-state block — what it does, what it does not yet
  cover (heap-Str and user ADTs), the two example fixtures, and
  the broader streaming-workloads motivation. No internals.

- docs/roadmap.md: the Stateful-islands milestone flips from [ ] to
  [~] (in progress). A Progress paragraph records sub-milestone 1
  (mut-local) as closed with its commit references, and enumerates
  the remaining sub-milestones (effect-handler infrastructure,
  refs + !Mut, MutArray, Stateful + pipe) — each to be brainstormed
  separately so each one stays small and audit-friendly.
This commit is contained in:
2026-05-15 09:22:48 +02:00
parent 20add51112
commit 8685e96970
2 changed files with 31 additions and 1 deletions
+14
View File
@@ -162,3 +162,17 @@ The prelude — until today the one file in the project authored as JSON-AST ins
Compiled programs are unchanged. Before deleting the old JSON file a one-time identity check ran to confirm that parsing the .ail prelude produces the exact same canonical module the JSON used to deserialise to; the check fired green, so the deletion was safe. A long-term hash anchor stays in place to catch accidental drift.
All tests green; benchmark scripts all pass at the existing baselines.
## 2026-05-15 — Local mutable state arrives
Programs can now declare mutable bindings inside a function body. A new block form opens a sealed region where the author names one or more mutable cells (with explicit types and initial values), can reassign them as the block runs, and can read their current value as any other identifier. Once the block ends the cells go out of scope — they cannot escape into a returned value, a closure, or anywhere else. The enclosing function's type signature stays pure: no new effect leaks out, so the caller sees the same contract as before.
The supported cell types are the four stack-resident scalars: integer, floating-point, boolean, unit. The heap-managed string type and any user-defined data type are deliberately not supported in this first cut — extending to them needs separate design work on how reassignment interacts with reference counting.
Two example programs ship to show the shape: one sums the integers from 1 to 10 using a mutable accumulator (prints 55), the other does the same for floating-point. Both run end-to-end through the build pipeline.
This is the first step on a longer arc. The motivation is real-world streaming computations — rolling indicators, online aggregates, sensor fusion — whose math is intrinsically "old state plus new input gives new state plus output" per step. Pure-functional state-threading expresses that, but at a real ergonomic cost as pipelines lengthen. Local mutable state is the foundation; later steps add escaping references, the effect annotation that goes with them, and a composable transducer type. The roadmap entry for the broader vision sits under the heading "Stateful islands — bounded mutation for streaming workloads".
A safety guard added at the same time: a lambda whose body refers to a mutable cell from an enclosing block is rejected by the type checker with a clear diagnostic, since cells are tied to their block's lifetime and cannot be lifted into a heap-stored closure without further design work.
All tests green. Benchmark scripts all pass at the (updated for this milestone) baselines.