No matching definitions.

tur/typeclass-clone

stdlib/typeclass-clone.tur

minimal Clone typeclass stub for definstance sites.

Auto-loaded so ref.tur and other modules can declare (definstance Clone [...] ...) without importing typeclass.tur.

Since: Phase B1

defclass

Clone

(defclass Clone [a])

values that can be copied into an independently owned value.

athe type to clone
(clone [x :a] :a)

a copy of x the caller owns. For a primitive this is x itself; for a refcounted handle (String, rc) it is a retain.

(clone 42)  ; => 42

Partner of Drop: a captured value that is Clone and Drop is retained when captured and released when the closure env dies.

Since: Phase B1

definstance

Clone[int]

(definstance Clone [int])

Clone instance for int (trivial copy).

Since: Phase B1

definstance

Clone[ref]

(definstance Clone [ref])

deep-clone a raw ref<T> (TY_REF): allocates a new int64_t cell and copies the value.

Since: Phase B1