OxL Reference

fn freeze

Moves value into an immutable shared Arc<frozen T> (§7.3).

Example:

oxl✓ checked in CI
fn main() io {
  let table = freeze({"a": 1})
  scope {
    let t2 = table.clone()
    let h = spawn lookup(t2)
    print("{h.join()!}")
  }
}

fn lookup(t: Shared<Map<str, i64>>) -> i64 pure => t.get("a") ?? 0
Output
1
@intrinsic("arc.new") pub(api) fn freeze<T>(value: T) -> Arc<frozen  T>

Since. 1.0.0-beta

Parameters

NameType
valueT

Returns

Arc<frozen T>

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/task.oxl:232

See also