11 lines
398 B
Plaintext
11 lines
398 B
Plaintext
;; A dyn captured by an fn. The copy lives in the fn's environment, which the
|
|
;; collector allocated and marks through the environment's descriptor, so the
|
|
;; value it names stays alive for as long as the function value does.
|
|
(defn run [f (Fn [] i64)] i64 (f))
|
|
|
|
;; [d] is unannotated, which is what makes it a dyn.
|
|
(defn use [d] i64
|
|
(run (fn [] (i64 d))))
|
|
|
|
(defn main [] i32 (println (use 7)) 0)
|