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.
44 lines
1.8 KiB
Plaintext
44 lines
1.8 KiB
Plaintext
;;;; The job ring between the listener thread and the game thread, and what it
|
|
;;;; does when it is full.
|
|
;;;;
|
|
;;;; The window this needs is "the listener has queued modules the game thread
|
|
;;;; has not looked at yet", and that window has to be held open by something
|
|
;;;; other than a timer — how long sixty-five connections take on a loaded
|
|
;;;; machine is exactly the kind of race a test must not be. So the program
|
|
;;;; blocks on stdin: the test fills the ring, checks what the agent said, and
|
|
;;;; only then writes the byte that lets the program poll.
|
|
(import agent "vendor:agent")
|
|
|
|
;;; libc's, declared straight: no aggregate crosses the boundary, so there is
|
|
;;; nothing for a shim to do.
|
|
(declare stdin-byte [] i32 "getchar")
|
|
|
|
(defonce ticks i64)
|
|
|
|
(defn tick [] i64
|
|
(set ticks (+ ticks 1))
|
|
ticks)
|
|
|
|
(defn main [args [string]] i32
|
|
(if (< (len args) 2)
|
|
(do (println "usage: agent-queue <socket>") 2)
|
|
(do
|
|
(if (< (agent/start (at args 1)) 0)
|
|
(do (println "cannot listen") 1)
|
|
(do
|
|
(println "ready")
|
|
(stdin-byte)
|
|
;; How many the ring actually held. Every module queued is installed
|
|
;; here, so this number is the count of slots that survived — which
|
|
;; is the whole claim: a ring that overwrote the slot it was reading
|
|
;; would answer with something else.
|
|
(print (agent/poll)) (println "")
|
|
;; Round two: one evaluated expression, whose rendering is longer
|
|
;; than the 4K the dev runtime will hold. The program has to still be
|
|
;; here afterwards for the value to be read back off the socket, so
|
|
;; it waits a third time and leaves on end of file.
|
|
(stdin-byte)
|
|
(print (agent/poll)) (println "")
|
|
(stdin-byte)
|
|
0)))))
|