2.6. Built-in Functions
Builtin functions are function-like expressions that are available without any modules. They implement inherent mechanisms of the language, in available in the AST as separate expressions. They are different from standard functions (see built-in functions).
2.6.1. Invoke
- invoke(block_or_function, arguments)
- invokecalls a block, lambda, or pointer to a function (block_or_function) with the provided list of arguments.
2.6.2. Misc
- assert(x, str)
- assertcauses an application-defined assert if the x argument is false.- assertcan and probably will be removed from release builds. That’s why it will not compile if the x argument has side effects (for example, calling a function with side effects).
- verify(x, str)
- verifycauses an application-defined assert if the x argument is false. The- verifycheck can be removed from release builds, but execution of the x argument stays. That’s why verify, unlike- assert, can have side effects in evaluating x.
- static_assert(x, str)
- static_assertcauses the compiler to stop compilation if the x argument is false. That’s why x has to be a compile-time known constant. ``static_assert``s are removed from compiled programs.
- concept_assert(x, str)
- concept_assertis similar to- static_assert, but errors will be reported one level above the assert. That way applications can report contract errors.
- debug(x, str)
- debugprints string str and the value of x (like print). However,- debugalso returns the value of x, which makes it suitable for debugging expressions:- let mad = debug(x, "x") * debug(y, "y") + debug(z, "z") // x*y + z