11.9. Compile-time build constants
The BUILD_CONST module provides compile-time constants from the build
environment. Each build_* accessor is a call macro that reads the daslang
process’s command line or environment variables while the requiring module
compiles, and splices the answer into the code as a literal — feed a global
let and gate code with static_if to erase the disabled branch entirely.
Interpreted and JIT runs resolve the constants per launch; an -exe build
bakes them at build time.
All functions and symbols are in “build_const” module, use require to get access to it.
require daslib/build_const
11.9.1. Call macros
- build_arg_int
build_arg_int(flag, dflt) — integer form of build_arg_value; garbage is a compile error.
- build_env_flag
build_env_flag(name) — boolean env rule: unset/””/0/false/off/no are false, anything else true.
- build_flag
build_flag(flag, env) — both-carrier boolean: true when flag is on the command line, else the env rule on env.
- build_arg_value
build_arg_value(flag, dflt) — the --name value / --name=value argument, or dflt.
- build_int
build_int(flag, env, dflt) — both-carrier integer; a garbage value on either carrier is a compile error.
- build_has_arg
build_has_arg(flag) — true when flag appears verbatim on the command line.
- build_env_int
build_env_int(name, dflt) — integer env value; set-but-empty is dflt, garbage is a compile error.
- build_env_value
build_env_value(name, dflt) — the environment value, or dflt when unset or empty.
- build_value
build_value(flag, env, dflt) — both-carrier string: command line beats environment beats dflt.