flan/test/programs/dev-robust.flan
Joseph Ferano a4c6b996ff def re-runs its initialiser, and defvar is renamed defonce
The trio the author decided on 2026-09-20 is now all built: def is CL's
defparameter — its initialiser runs on every daemon re-run, unguarded, so
an edited initialiser repaints the same storage on C-c C-c plus re-run —
defonce (Clojure's name for CL's defvar, per the author) initialises once
behind the .init~once. flag, and defconst stays the image.

One parse arm reads both forms; the difference is Ast.reinit, carried to
Tast.global's grerun. Emit.startup_plan gives a def no guard flag, and
Check.check_global lifts every def initialiser — zero and literal
included — into global/<n>, so the host's startup reaches it through the
function cell and a re-evaluated def swaps it (Session's def_inits;
Emit.redefinition declares the cell for a non-sibling target). The old
defvar spelling is refused with the rename and both compiling spellings,
and every program, test, doc and editor list is swept — except sand.flan,
the author's live WIP, whose seven defvar lines are flagged in FIX.org
and keep its three dependent tests red on this branch.
2026-09-21 07:12:04 +07:00

29 lines
1.2 KiB
Plaintext

;;;; A program to send failing evaluations at, for as long as it takes.
;;;;
;;;; Same shape as dev-repl.flan and for the same reason — C-x C-e is a thunk
;;;; the agent runs at a frame boundary, so a program under test has to keep
;;;; reaching them — but with room to spare. What test_dev.ml drives here is
;;;; the *failing* path, and a failure in this loop costs a clang driver that a
;;;; success does not: the macro module is built from scratch, thrown away, and
;;;; built again. dev-repl.flan's 4000 frames are twenty seconds, which is less
;;;; than that sequence takes on a cold cache, and a program that ran out mid
;;;; test would look exactly like the session death the test is here to deny.
;;;;
;;;; Two minutes, then, against a block that runs in well under one: enough
;;;; margin for a cold machine, and short enough that an aborted run does not
;;;; leave a process of this behind for the rest of the afternoon.
(import agent "vendor:agent")
(defonce ticks i64)
(defn step [] i64
(set ticks (+ ticks 1))
ticks)
(defn main [] i32
(agent/start "/tmp/flan-dev-robust-fallback.sock")
(dotimes [i 24000]
(agent/wait 5)
(set ticks (step)))
0)