print-str, print-i64, print-f64, print-bytes, print-line and newline leave the prelude. print and println are the whole printing surface now, and print is the better call at every one of the sites that used them: it is the same structural walk without the newline, so the no-newline case the family was kept for is covered, and it takes the value as it is. The old print-i64 forced an explicit (i64 x) at every call site, because this language widens nothing implicitly; that cast is gone from 127 places. Dropping it moves one answer. hash-grid returns u64, and the cast through the signed printer showed sand-headless's hash as -2851001042534928384. print routes a u64 through flan_u64_to_bytes, so it now prints 15595743031174623232 — the same 64 bits, read as the unsigned number they are. The pinned expectation follows the correction. test-flan-dev.el and test_session.ml both reached for print-line as "a name the prelude has"; they reach for rand-seed instead.
35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
;;;; The dev-build break loop — spec-conditions.md §2.
|
|
;;;;
|
|
;;;; An unhandled error used to kill the program. Here it stops instead, on the
|
|
;;;; frame that erred with nothing unwound, and waits for someone to pick a
|
|
;;;; restart. Two of them, and the run takes a different one each time, so a
|
|
;;;; break loop that always resumed the same way could not pass.
|
|
(import agent "vendor:agent")
|
|
|
|
(defstruct Missing [id i32])
|
|
|
|
(defn fetch [n i32] i32
|
|
(restart-case
|
|
(do (error (Missing {:id n})) 0)
|
|
(use-placeholder [] -1)
|
|
(retry [] 7)))
|
|
|
|
;;; Two frames offering the same name, which §4 says resolves to the inner one
|
|
;;; and only ever the inner one. The outer clause is therefore on every list a
|
|
;;; break loop prints and reachable from no name at all, which is why a restart
|
|
;;; is taken by *index* now. 900 is the proof: it is the only value in this
|
|
;;; file that by-name lookup cannot produce.
|
|
(defn shadowed [n i32] i32
|
|
(restart-case
|
|
(+ (restart-case (do (error (Missing {:id n})) 0)
|
|
(retry [] 5))
|
|
100)
|
|
(retry [] 900)))
|
|
|
|
(defn main [] i32
|
|
(agent/start "/tmp/flan-break.sock")
|
|
(print (fetch 1)) (println "")
|
|
(print (fetch 2)) (println "")
|
|
(print (shadowed 3)) (println "")
|
|
0)
|