flan/test/programs/dev-trap-null-alloc.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

19 lines
806 B
Plaintext

;;;; The same claim as dev-trap-free-all.flan over the other allocator trap,
;;;; and with nothing on the restart stack.
;;;;
;;;; `nowhere` is a zeroed `Allocator` — a `defonce` nobody assigned — and
;;;; `free-all` on it is the "I released the region" / "I never made one"
;;;; collapse the runtime refuses to let a program spell the same way. The
;;;; refusal is a trap with no transfer channel, so it parks rather than
;;;; resumes, and here there is not even a restart to list: the break loop says
;;;; so and stands still, which is the whole difference between a session you
;;;; can fix the program in and a daemon that is gone.
(import agent "vendor:agent")
(defonce nowhere Allocator)
(defn main [] i32
(agent/start "/tmp/flan-dev-trap-null-alloc-fallback.sock")
(free-all nowhere)
0)