The script is in tools/ rather than thrown away, because two lanes are
writing Flan in the old spelling right now and their files need the same
pass at merge.
It works on forms, not on text: a keyword becomes a dot only where it sits
in a field-label position inside a brace, so an enum member in value
position, a map key inside an EDN string and a type-position {K V} are all
left alone. :keys keeps its colon -- it names no field.
35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
;;;; A program that stops with something worth looking at in the frame.
|
|
;;;;
|
|
;;;; dev-break.flan proves an editor can find out *that* a program stopped and
|
|
;;;; choose a restart; this one is about what the frame holds while it is
|
|
;;;; stopped. One local of each shape the structural printer has an arm for —
|
|
;;;; a parameter, a string, a struct, a fixed array, a bool — plus one that is
|
|
;;;; bound only *after* the error, which is the case that must come back
|
|
;;;; refused rather than rendered: its slot is storage nothing has written yet.
|
|
(import agent "vendor:agent")
|
|
|
|
(defstruct Point [x f32 y f32])
|
|
(defstruct Boom [why i32])
|
|
|
|
(defn look [n i64 label string] i64
|
|
(let [p (Point {.x 1.5 .y 2.5})
|
|
xs [10 20 30]
|
|
flag (> n 0)]
|
|
(restart-case
|
|
(do (error (Boom {.why 7}))
|
|
;; Never reached before the break, so [after] is a slot with nothing
|
|
;; in it: the frame records a null for it and this is what "not bound
|
|
;; yet" has to mean.
|
|
(let [after (i64 99)] after))
|
|
(carry-on [] 5))))
|
|
|
|
(defvar ticks i64)
|
|
|
|
(defn main [] i32
|
|
(agent/start "/tmp/flan-dev-locals-fallback.sock")
|
|
(print (look 3 "hello")) (println "")
|
|
(dotimes [i 4000]
|
|
(agent/wait 5)
|
|
(set ticks (+ ticks 1)))
|
|
0)
|