OxL Справочник OxL
РусскийEnglish

kw msg

Зарезервированное слово

Список слов: §1.4

Синтаксис

ebnf
ActorMember = { Attr } ( "var" Ident ":" Type "=" Expr | "dep" Ident ":" Type
            | "msg" Ident "(" [ Params ] ")" [ "->" Type ] Block
            | "on" ( "activate" | "passivate" ) Block ) ;

Грамматика: Прил. A

Определяется в

Примеры

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)

— 8.8 Локальные акторы

oxl
@idle(ACCOUNT_IDLE)
actor Account sharded by id: AccountId {
  var balance: Money = Money.zero()
  @transient var hits: u64 = 0
  on activate { log.debug("account {id} up") }
  msg deposit(x: Money) { balance += x }
  msg balance() -> Money { balance }
}

Account(id).deposit(amount)

— 12.5 Шардированные акторы

Связанные диагностики

actor-cycle, actor-not-hosted, data-rights, missing-policy, unknown-policy-target, break-value, outside-loop, fail-type, question-context, unhandled-error

См. также