OxL Reference

kw send

Contextual keyword — select branches (§8.7)

The list of words: §1.4

Syntax

ebnf
SelArm      = ( "recv" Pattern "from" Expr | "send" Expr "to" Expr | "after" Expr | "else" ) "=>" Expr ;

Grammar: App. A

Defined in

Examples

oxl
let (tx, rx) = chan<Job>(cap: JOB_QUEUE)

select {
  recv job from rx  => process(job)
  send r to results => sent += 1
  after IDLE_TIMEOUT => log.info("idle")
  else              => tick()          // non-blocking variant
}

— 8.7 Channels and select

Related diagnostics

bad-init, missing-field, must-close, positional-literal, sealed-literal

See also