OxL Reference

kw it

Contextual keyword — a step of a chain or pipeline (§8.4, §10.6)

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 ] ")" ] ;

Grammar: App. A

Defined in

  • 10.6 Pipelines — A pipeline is a linear chain of steps, each of which runs on its own node; data is passed from node to node directly, the caller receives on
  • 8.4 Chains — A chain links asynchronous steps so that either the whole chain is executed or the first unhandled error is returned.
  • 1.4 Keywords — Reserved (cannot be used as names)
  • 8.8 Local actors — Messages are processed strictly one at a time, in the order of arrival from each sender.
  • 11.3 Sagas — A saga is a sequence of steps (the step syntax is as in a chain, §8.4); after a step there MAY be undo x => compensation, where x is the res

Examples

oxl
pipeline uploadPhoto(img: Image) -> PhotoId {
  validate
  -> Store.put(it)              on storage
  -> respond it.id
  -> resize(it, THUMB_SIZES)    on gpu
  -> moderate                   on ml  durable
  -> SearchIndex.add(it)
} on_error(e, step) { Dlq.push(e, step) }

— 10.6 Pipelines

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

Related diagnostics

pipeline-idempotency, respond-twice, respond-type, unknown-role, it-outside-chain, actor-cycle, saga-decl, saga-idempotency

See also