43. Constant expression checker

The constexpr module implements constant expression function argument check.

All functions and symbols are in “constexpr” module, use require to get access to it.

require daslib/constexpr

43.1. Function annotations

constexpr

This macro implements a constexpr function argument checker. Given list of arguments to verify, it will fail for every one where non-constant expression is passed. For example:

[constexpr (a)]
def foo ( t:string; a : int )
    print("{t} = {a}\n")
var BOO = 13
[export]
def main
    foo("blah", 1)
    foo("ouch", BOO)    // comilation error: `a is not a constexpr, BOO`