OxL Reference

data Task

Lazy asynchronous computation with value T or error E (§8.3).

Example:

oxl✓ checked in CI
fn square(n: i64) -> i64 => n * n

fn main() io {
  let h = scope {
    let a = spawn square(6)
    a.join()!
  }
  print("{h}")
}
Output
36
@builtin("Task") pub(api) data Task<T, E>

Thread safety. a task runs on the scheduler of the node; its value moves to whoever joins it.

Since. 1.0.0-beta

Defined in: std/core/types.oxl:395

See also