kw msg
Reserved keyword
The list of words: §1.4
Syntax
ActorMember = { Attr } ( "var" Ident ":" Type "=" Expr | "dep" Ident ":" Type
| "msg" Ident "(" [ Params ] ")" [ "->" Type ] Block
| "on" ( "activate" | "passivate" ) Block ) ;Grammar: App. A
Defined in
- 8.8 Local actors — Messages are processed strictly one at a time, in the order of arrival from each sender.
- 12.5 Sharded actors — The key is declared in the header (sharded by name
- 13.4 Authorisation and policies — The subject of a policy
- 6.6 Panic — Causes: overflow, division by zero, out-of-bounds access, x!
- 1.4 Keywords — Reserved (cannot be used as names)
- 5.6 Loops — for accepts Iterable<T> (including iter<T>, collections, ranges); for await accepts Streamable<T>.
- 6.5 Errors — There are no exceptions.
Examples
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)@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)Related diagnostics
actor-cycle, actor-not-hosted, data-rights, missing-policy, unknown-policy-target, break-value, outside-loop, fail-type, question-context, unhandled-error