flan/test/programs/watch-release.flan

28 lines
682 B
Plaintext

;;;; (watch "name" v) in a build with no dev session behind it.
;;;;
;;;; Outside a dev build a watch makes no call into the runtime: 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)