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.
26 lines
918 B
Plaintext
26 lines
918 B
Plaintext
;;;; debug.flan with the fields of Cell in a different order and nothing else
|
|
;;;; changed. The program prints the same four lines; the struct is a different
|
|
;;;; shape, and every member sits at a different offset.
|
|
;;;;
|
|
;;;; name at 0 (16), id at 16, alive at 20, 3 of padding, heat at 24 — so a
|
|
;;;; DWARF offset table that is right for debug.flan is wrong for all four
|
|
;;;; members here, which is what makes the pair a test rather than an
|
|
;;;; observation.
|
|
|
|
(defstruct Cell [name string id i32 alive bool heat f64])
|
|
|
|
(defn tick [c (Ptr Cell) n i32] i32
|
|
(let [bump (+ n 1)]
|
|
(set (.heat c) (+ (.heat c) 1.5))
|
|
(set (.id c) bump)
|
|
bump))
|
|
|
|
(defn main [] i32
|
|
(let [c (Cell {:alive true :heat 3.25 :id 7 :name "grain"})]
|
|
(let [r (tick (addr c) 41)]
|
|
(print r) (println "")
|
|
(print (.heat c)) (println "")
|
|
(print (.id c)) (println "")
|
|
(print (.name c)) (println "")
|
|
0)))
|