OxL Reference

data ActorRef

Reference to a local actor (§8.8); messages are sent with method-call syntax.

Example:

oxl✓ checked in CI
actor Counter {
  var n: i64 = 0
  msg bump() -> i64 {
    n += 1
    n
  }
}

provide ActorRef<Counter> = spawn Counter()

fn main() io {
  let c: ActorRef<Counter> = spawn Counter()
  c.bump()
  print("{c.bump()}")
}
Output
2
@builtin("ActorRef") pub(api) data ActorRef<A>

Thread safety. copyable; messages are processed one at a time by the actor.

Since. 1.0.0-beta

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

See also