;;;; Value semantics, spec-memory.md. Not covered by calc-me, and the property ;;;; most likely to be silently wrong in a backend: a struct or a fixed array ;;;; copies on assignment, a slice copies only its view. (defstruct P [x i32]) (defvar arr [3 i32]) (defn main [] i32 (let [a (P {:x 1})] (let [b a] ; a copy, not an alias (set (.x a) 99) (print (.x b)) (println ""))) ; 1 (set (at arr 0) 5) (let [c arr] ; fixed arrays are values too (set (at arr 0) 77) (print (at c 0)) (println "")) ; 5 (let [s (bytes "hello")] (let [v (slice s 1 3)] ; a view into the same bytes (print v) (println ""))) ; el 0)