29 lines
722 B
Plaintext
29 lines
722 B
Plaintext
;;;; (watch "name" v) in a build with no dev session behind it.
|
|
;;;;
|
|
;;;; Nothing arms the watch table here, so every watch is the load and the
|
|
;;;; branch and nothing else: the program must compile, link and print exactly
|
|
;;;; what it prints without them. The value is still evaluated once, which the
|
|
;;;; counter shows.
|
|
|
|
(defstruct Pos [x i32 y f64])
|
|
|
|
(defonce calls i64)
|
|
|
|
(defn bump [] i64
|
|
(set calls (+ calls 1))
|
|
calls)
|
|
|
|
(defn main [] i32
|
|
(let [p (Pos {.x 3 .y 1.5})
|
|
xs [1 2 3]
|
|
d {:a 1}]
|
|
(watch "pos" p)
|
|
(watch "xs" xs)
|
|
(watch "slice" (slice xs 0 2))
|
|
(watch "dyn" d)
|
|
(watch "label" "sand")
|
|
(watch "bump" (bump))
|
|
(watch "bump" (bump))
|
|
(println (.x p) calls))
|
|
0)
|