OxL Reference

kw old

Contextual keyword — function contracts (§6.7)

The list of words: §1.4

Defined in

  • 6.7 Contracts — requires is checked on entry, ensures on exit (result is the return value, old(e) is the value of e on entry), invariant (§4.2) — after cons
  • 1.4 Keywords — Reserved (cannot be used as names)
  • 9.2 Field numbers and schema — Every field of a data and every variant of an enum has a stable tag (the number in the wire format).

Examples

oxl
fn withdraw(acc: &var Account, amt: Money)
  requires amt > Money.zero()
  ensures acc.balance == old(acc.balance) - amt
{ … }

— 6.7 Contracts

Related diagnostics

contract, schema-attr, schema-break

See also