OxL Reference

error not-comptime

error Standard: [§15.1]

What it means#

const initialisers, associated constants, array lengths and attribute arguments MUST be comptime expressions (§4.1, §4.9, §15.1): literals, other constants and calls to comptime functions. Ordinary functions, and anything with effects, cannot run at compile time.

Example#

oxl✓ checked in CI
fn compute() -> i32 => 6 * 7

const ANSWER: i32 = compute()      // <- not-comptime
error
not-comptime

How to fix#

oxl✓ checked in CI
comptime fn compute() -> i32 => 6 * 7

const ANSWER: i32 = compute()

Mark the function comptime (it must then be deterministic and free of effects), or write the value directly.

See also#

OxL 1.0.0-beta · Documentation version 1.0.0-beta© OxwaldLink · generated from the Standard, the std sources and the guides