OxL Reference

4.1 Variables and constants

FormSemantics
let x = eimmutable binding
var x = emutable binding
let x: T = ewith an explicit type
const NAME: T = ethe value is evaluated at compile time; e MUST be a comptime expression; allowed at module level and inside functions
static NAME: T = ea module-level global value; initialised once on first access, thread-safe; T MUST be frozen or sync
  • There are no mutable globals without sync.
  • let MAY shadow a name in a nested and in the same scope.
  • Destructuring: let (a, b) = pair, let User{ name, .. } = u.

global-mutable, mutate-immutable

See also

Source: docs/spec/oxl-standard.en.md