OxL Reference

kw await

Reserved keyword

The list of words: §1.4

Syntax

ebnf
Primary     = Literal | Path | "it" | "self" | "(" Expr { "," Expr } ")" | ListLit | MapLit
            | StructLit | Lambda | Block | If | Match | For | While | Loop | Scope | Select | Query
            | "spawn" ( Postfix | Block ) | "await" Unary | "atomic" [ "(" Args ")" ] Block
            | "return" [ Expr ] | "fail" Expr | "yield" Expr | "respond" Expr | "break" [ Label ] [ Expr ]
            | "continue" [ Label ] | "emit" Path "(" Expr ")" | "unsafe" Block | "blocking" Block
            | "comptime" Block | "." Ident [ "(" [ Args ] ")" ] ;
ebnf
For         = [ Label ":" ] [ "inline" ] "for" [ "await" ] Pattern "in" Expr [ "where" Expr ] Block ;

Grammar: App. A

Defined in

Examples

oxl
let page = Users.get(id)
  -> (Orders.recent(it.id), Recs.for(it.id))
  -> (orders, recs) => Page{ orders, recs }
  ~> Audit.log("page", id)
  !> Timeout => Page.empty()
  within PAGE_DEADLINE
  retry 2

let html = await page

— 8.4 Chains

oxl
let prices = Broadcast<Tick>(buffer: TICK_BUFFER, slow: .DropOldest, replay: 1)

scope {
  spawn { for await t in Exchange.feed() { prices.publish(t) } }
  spawn { for await t in prices.subscribe() { ui.render(t) } }
  spawn { for await t in prices.subscribe() { stats.add(t) } }
}

impl Market {
  rpc ticks() -> stream<Shared<Tick>, Lagged> => prices.subscribe()   // for every client
}

— 10.4 Broadcast — local fan-out

Related diagnostics

it-outside-chain, chained-comparison, task-reuse, break-value, outside-loop, yield-outside-stream

See also