OxL Reference

method TVar.clone

Another handle of the same variable.

Example:

oxl✓ checked in CI
use std.stm { TVar }

fn main() io {
  let a = TVar<i64>.new(1)
  let b = a.clone()
  atomic { b.set(5) }
  print(atomic { a.get() })
}
Output
5
pub(api) fn clone() -> TVar<T>

Since. 1.0.0-beta

Returns

TVar<T>

Effects

none declared (pure unless the body says otherwise)

Defined in: std/stm/stm.oxl:162

See also