;;;; 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))