;;;; A program that stops on a trap it cannot be resumed from, for driving the ;;;; break loop over one. ;;;; ;;;; dev-break-bounds.flan is the case where stopping and *resuming* both work: ;;;; a bad index signals BoundsError, the walk finds nothing, and the break ;;;; loop hands the program back to its own `continue`. This is the other half. ;;;; `free-all` on an allocator that has no region to release is a refusal the ;;;; emitted code makes no channel for — it calls the trap and falls off the ;;;; end — so there is nothing for a chosen restart to transfer into, and until ;;;; now that meant `_exit(134)`, which under a merged `flan dev` is the ;;;; session and the compiler as well as the program. ;;;; ;;;; The claim is that the session survives it anyway. The program stops where ;;;; it erred, everything is readable, and the *resume* is the only thing ;;;; refused — with a sentence saying why, rather than by the process being ;;;; gone before anyone could ask. ;;;; ;;;; The `restart-case` is load-bearing and not scenery: with no restart on the ;;;; stack the break loop would say "no restarts are active" and the refusal ;;;; that had to be written would never run. `continue` is live, is listed, and ;;;; is still not takeable — which is exactly the state this trap leaves a ;;;; program in. (import agent "vendor:agent") (defn release [] () ;; The heap allocator frees one block and owns no region, so this traps. (free-all (heap-allocator))) (defn main [] i32 (agent/start "/tmp/flan-dev-trap-free-all-fallback.sock") (restart-case (release) (continue [] (println "resumed"))) 0)