OxL Reference

op >

>

Precedence: 4   Associativity: none (a < b < c is an error)

Defined in

Examples

oxl
impl Vec3 {
  static op +(a: Vec3, b: Vec3) -> Vec3 => Vec3(a.x + b.x, a.y + b.y, a.z + b.z)
  static op *(v: Vec3, k: f32) -> Vec3 => Vec3(v.x * k, v.y * k, v.z * k)
  static op -(v: Vec3) -> Vec3 => v * -1.0
  op [](i: usize) -> f32 { … }            // read by index
  var op [](i: usize) -> &var f32 { … }   // write by index
  op ()(t: f32) -> Vec3 { … }             // call as a function
  static op <=>(a: Vec3, b: Vec3) -> Ordering { … }
  op as Vec4 => Vec4(x, y, z, 1.0)
}

— 5.3 Overloading and user-defined operators

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

chained-comparison, not-callable, not-overloadable, operator-decl, range-not-iterable, invalid-char, it-outside-chain, schema-attr

See also