;;;; A program that stops, for driving the break loop from an editor. ;;;; ;;;; It errors on its first frame, with nothing having handled the condition, ;;;; so [flan dev] meets a program that is already stopped — which is the state ;;;; an editor has to cope with, and the one that is hardest to arrange on ;;;; purpose later. Two restarts are on offer and they return different values, ;;;; so the transcript says which one was chosen. ;;;; ;;;; After resuming it keeps polling, because the claim worth testing is that ;;;; everything else still works on either side of a break. (import agent "vendor:agent") (defstruct Missing [id i32]) (defn fetch [n i32] i32 (restart-case (do (error (Missing {:id n})) 0) (use-placeholder [] -1) (retry [] 7))) (defvar ticks i64) (defn step [] i64 (set ticks (+ ticks 1)) ticks) (defn main [] i32 (agent/start "/tmp/flan-dev-break-fallback.sock") (print-i64 (i64 (fetch 1))) (newline) (dotimes [i 4000] (agent/wait 5) (set ticks (step))) 0)