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.
27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
;;;; The reload primitive's fixture, v2. Three differences from v1, each one a
|
|
;;;; separate thing being checked:
|
|
;;;;
|
|
;;;; [bump] steps by 10 and adds 1000, so the host's untouched call site in
|
|
;;;; [outer] visibly runs the new body rather than the one it was linked to.
|
|
;;;;
|
|
;;;; [bump] also calls *itself*. Inside a shared object a plain call would be
|
|
;;;; interposed by the host's copy — the module would look self-consistent and
|
|
;;;; silently run the old body — so the self-call goes through the cell like
|
|
;;;; any other. If it did not, the first recursive step would print "v1" and
|
|
;;;; the transcript would say so.
|
|
;;;;
|
|
;;;; [helper] is changed only as a tripwire. The module declares it rather than
|
|
;;;; defining it, so this body is dead text and the call has to land on the
|
|
;;;; host's [* x 2]; with the two bodies identical nothing at run time would
|
|
;;;; notice a module that grew its own copy.
|
|
(defvar counter i64)
|
|
|
|
(defn helper [x i64] i64 (* x 3))
|
|
|
|
(defn bump [] i64
|
|
(println "v2")
|
|
(set counter (+ counter 10))
|
|
(if (> counter 100) (+ (helper counter) 1000) (bump)))
|
|
|
|
(defn outer [] i64 (bump))
|