Commit 214a08f
feat(L10): rung 3b static half — cross-handler named residues
Roadmap item 2. A `reversible as <name>` in one handler is now reversible by
`reverse <name>` in ANOTHER handler of the same agent — the residue is carried
through agent state.
agent ReversibleWorker {
control {
on receive(amount: Int) { reversible as undo { … } } -- declares `undo`
on error(reason: String) { reverse undo } -- replays it
}
}
The per-handler isolation that previously severed this is lifted: `check_agent_decl`
collects, per agent, the set of names any handler declares (`agent_residue_names`)
before checking handlers. A cross-handler `reverse <name>` type-checks by
PRESENCE — the name is declared by some handler.
The discipline is honestly split:
- Within one handler, the rung-3a LINEAR discipline still holds: an in-body
double-`reverse` is rejected. `take_named_residue` now returns a three-way
`ResidueTake` (Took / AlreadySpent / NotPresent) so the in-body `AlreadySpent`
error is not masked by agent-level presence.
- Across handlers, acceptance is by presence only — the once-only property is
irreducibly RUNTIME (handler firing order is not statically known;
`takeForReverse : Maybe`). The runtime replay is the remaining follow-on.
- Cross-FUNCTION carry stays rejected (functions don't share state).
3 new typechecker tests + `examples/cross_handler_reversibility.007`
(parse + typecheck + run all pass). 900 oo7-core lib tests pass; fmt + clippy
clean. Spec §11b.6 + docs/echo-residue-integration.adoc + CHANGELOG in lockstep.
https://claude.ai/code/session_018CaSgNjNURC7ocsyjYh9We1 parent e69c02c commit 214a08f
7 files changed
Lines changed: 286 additions & 48 deletions
File tree
- .machine_readable
- crates/oo7-core/src
- docs
- examples
- spec
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
0 commit comments