flan/test/programs/dev-pause.flan
Joseph Ferano 5791faee4e A breakpoint is a function call, and the editor only says where
Finishes DISCUSS.md §9's `pause` marking: the daemon half was already
built, this is the editor half plus the one daemon path it was missing.

`C-u C-c C-c` marks the form point is inside, `C-u C-u C-c C-c` the
top-level form (stop on entry), `C-u C-x C-e` the expression before
point. The buffer is never edited — the position rides beside the code
and the `(pause)` call goes into the tree after parsing, so no source
location moves.

`C-x C-e`'s path needed the daemon: its 5s `wait` answered "the program
did not reach a frame boundary", which is exactly what a thunk parked at
a breakpoint looks like from out here. `wait` is now three-way and asks
`state t = Stopped` only when a pause was requested, so the no-pause
shape `test_dev.ml` pins is unchanged.

The overlay is an annotation and not feedback, so unlike an error marker
it survives `pre-command-hook`; what takes it down is an accepted
evaluation with no `:pause` on it, which is the same thing that takes
the mark itself down.

Tests: a `test_dev.ml` block over the new `dev-pause.flan` that marks,
stops, re-evaluates plainly and then polls half a second confirming it
does not stop again — one sample after `continue` proves nothing, the
resumed frame is still in the old body — and an `emacs/test-flan-dev.el`
block for which form a prefix picks, the byte column, the overlay's
lifetime, and one live round trip.
2026-09-13 12:51:06 +07:00

25 lines
837 B
Plaintext

;;;; A program to set a breakpoint in, for driving `C-u C-c C-c' from an editor.
;;;;
;;;; Unlike dev-break.flan it does not stop on its own: it starts running and
;;;; keeps running, because the claim being tested is that marking a form is
;;;; what stops it. Anything already stopped would prove nothing.
;;;;
;;;; What it needs is a function that keeps being called, so that a mark set
;;;; after startup is hit, and hit again after the mark is cleared. dev-loop.flan
;;;; calls [step] four times, which is too tight for that; this is dev-break.flan's
;;;; tail with nothing in front of it.
(import agent "vendor:agent")
(defvar ticks i64)
(defn step [] i64
(set ticks (+ ticks 1))
ticks)
(defn main [] i32
(agent/start "/tmp/flan-dev-pause-fallback.sock")
(dotimes [i 4000]
(agent/wait 5)
(set ticks (step)))
0)