The first cut of the form-change refusal asked only about def and defonce and asserted in its comment that defconst was another arm's business. It was not: defconst to def at the same type fell past every arm, and defonce to defconst fell past them into the consts republish, which stores the declared value over live storage at the frame boundary. One refusal over gconst and grerun together now covers all six directions. And two coverage gaps closed by running rather than reasoning: reload-v6 carries a (def dial i64 5) the host was never built with, so the x86 image path executes and its 5 shows in the transcript's arithmetic; dev-rerun's echo reads counter in its initialiser and follows it 40, 41, 42, 43 across re-runs, where a captured first answer would print 40 four times.
28 lines
1.3 KiB
Plaintext
28 lines
1.3 KiB
Plaintext
;;;; A run-time-new global with a value of its own, which is the half of the
|
|
;;;; new-name path that a zeroed defonce cannot measure: [flan_dev_global]
|
|
;;;; allocates with calloc, so a global declared zero looks right whether or
|
|
;;;; not its initial value travelled with the module. [tuning] is 42, and the
|
|
;;;; transcript is the number the host prints, so an image that never arrived
|
|
;;;; prints 4 rather than 88.
|
|
;;;; [dial] is the same claim for the other mutable form, and it is the one
|
|
;;;; that needs saying: every def initialiser is lifted into [global/<n>] so
|
|
;;;; that re-evaluating the form can swap it through a cell, which means a
|
|
;;;; def's own [ginit] is a *call* and never a constant. A backend that asked
|
|
;;;; [Tast.const_init] about it — both of them did — would send a null image
|
|
;;;; and this global would be 0 for the life of the process, with no startup
|
|
;;;; in the host to ever put 5 there. [Emit.initial_image] reads the constant
|
|
;;;; back out of the lifted body, and this transcript is the x86 backend
|
|
;;;; running that answer rather than a disassembly agreeing with it.
|
|
(defonce counter i64)
|
|
(defonce tuning i64 42)
|
|
(def dial i64 5)
|
|
|
|
(defn helper [x i64] i64 (* x 2))
|
|
|
|
(defn bump [] i64
|
|
(println "v6")
|
|
(set counter (+ counter tuning dial 1))
|
|
(helper counter))
|
|
|
|
(defn outer [] i64 (bump))
|