OxL Reference

8.8 Local actors

oxl
actor Session {
  var cart: Cart = Cart.empty()
  msg add(item: Item) { cart.push(item) }
  msg total() -> Money { cart.sum() }
}

let s = spawn Session()           // ActorRef<Session>
s.add(item) -> s.total() -> show(it)
  • Messages are processed strictly one at a time, in the order of arrival from each sender.
  • A msg call is suspendable; it completes after the message has been processed and returns the result. For "fire and forget" use ~> or spawn.
  • The actor state (var) is accessible only from its msgs. Arguments and results MUST be transferable (§7.3).
  • Waiting for another actor inside a msg is allowed; the analyzer marks cyclic waits with a warning.
  • Distributed (sharded) actors — §12.5.

actor-cycle

See also

Source: docs/spec/oxl-standard.en.md