Version: 1.1.0

Materialization

Materialization is the moment a compile-time value becomes something runtime code can use. Parameters start on the compile-time side of that line.

Essentials

  • Reading a parameter inside ordinary code materializes it as a constant.
  • Some types exist only at compile time and must be converted explicitly.
  • Alias declarations give a compile-time name to a type or value.
  • Materializing inside a loop does not recompute the parameter.

Example

alias WIDTH = 8

fn main():
    var n: Int = WIDTH
    print(n)

Keep in mind

Keep heavy tables in parameters when every entry is known ahead of time, and materialize only the slice you need at runtime.