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.
42 lines
2.0 KiB
Plaintext
42 lines
2.0 KiB
Plaintext
;;;; A program that prints far more than a pipe holds, for the one failure a
|
|
;;;; quiet fixture cannot reach.
|
|
;;;;
|
|
;;;; In a merged `flan dev' the program's stdout is a 64K pipe back into the
|
|
;;;; same process, and the only thing reading it is the daemon's accept loop —
|
|
;;;; which is not running while the daemon is answering a request. Every other
|
|
;;;; fixture here prints a line or two per frame, so the pipe never fills and
|
|
;;;; the arrangement looks sound. This one prints 4K per frame, which fills 64K
|
|
;;;; in sixteen frames: less time than a module takes to build. By the time an
|
|
;;;; evaluation is delivered the game thread is stopped inside fwrite, and it
|
|
;;;; stays there until somebody reads — so a daemon that waits for a frame
|
|
;;;; boundary without draining waits for one that cannot arrive, and then says
|
|
;;;; the program is not calling (agent/poll).
|
|
;;;;
|
|
;;;; It is calling it. See lib/dev.ml's [eval_expr], which drains every tick.
|
|
(import agent "vendor:agent")
|
|
|
|
;;; Counted so that an evaluation has something of the program's own to read,
|
|
;;; and so a transcript can be checked for progress rather than only for text.
|
|
(defonce frames i64)
|
|
|
|
(defn chatter [] i64
|
|
;; Sixty-four lines of sixty-three characters and a newline: 4096 bytes a
|
|
;; frame, written through the line buffer flan_rt.c asks for, so each line
|
|
;; is its own write and the block happens in the middle of a frame rather
|
|
;; than at a flush somewhere else.
|
|
(dotimes [i 64]
|
|
(println "..............................................................."))
|
|
(set frames (+ frames 1))
|
|
frames)
|
|
|
|
(defn main [] i32
|
|
(agent/start "/tmp/flan-dev-chatty-fallback.sock")
|
|
;; 24000 for dev-repl.flan's reason: the test closes the connection when it
|
|
;; is done and the daemon takes the program with it, so the count only has
|
|
;; to outlast the checks. A program that reached its last frame mid-test
|
|
;; would fail honestly and for the wrong reason.
|
|
(dotimes [i 24000]
|
|
(chatter)
|
|
(agent/wait 1))
|
|
0)
|