OxL Reference

kw let

Reserved keyword

The list of words: §1.4

Syntax

ebnf
Stmt        = ( "let" | "var" ) Pattern [ ":" Type ] "=" Expr | Const | Place AssignOp Expr
            | "defer" Expr | Expr ;
ebnf
If          = "if" ( Expr | "let" Pattern "=" Expr ) Block [ "else" ( If | Block ) ] ;
ebnf
While       = [ Label ":" ] "while" ( Expr | "let" Pattern "=" Expr ) Block ;

Grammar: App. A

Defined in

Examples

oxl
let top = from o in db.Order
  where o.userId == uid && o.total > MIN_TOTAL
  order by o.createdAt desc
  skip page * PAGE_SIZE
  take PAGE_SIZE
  load(items)

let names = from u in users where u.active select u.name   // in-memory List
let byRole = from u in users group by u.role into g select (g.key, g.count())

— 5.9 Query expressions

oxl
let (a, b) = scope {
  let ha = spawn loadA()
  let hb = spawn loadB()
  (ha.join()?, hb.join()?)
}

— 8.5 Structured concurrency

Related diagnostics

global-mutable, mutate-immutable, bad-init, missing-field, must-close, positional-literal, sealed-literal, query-not-sql, spawn-outside-scope, it-outside-chain

See also