.. _stdlib_build_const: ============================ Compile-time build constants ============================ .. das:module:: build_const 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. .. code-block:: das require daslib/build_const +++++++++++ Call macros +++++++++++ .. _call-macro-build_const-build_arg_int: .. das:attribute:: build_arg_int ``build_arg_int(flag, dflt)`` — integer form of ``build_arg_value``; garbage is a compile error. .. _call-macro-build_const-build_env_flag: .. das:attribute:: build_env_flag ``build_env_flag(name)`` — boolean env rule: unset/""/0/false/off/no are false, anything else true. .. _call-macro-build_const-build_flag: .. das:attribute:: build_flag ``build_flag(flag, env)`` — both-carrier boolean: true when ``flag`` is on the command line, else the env rule on ``env``. .. _call-macro-build_const-build_arg_value: .. das:attribute:: build_arg_value ``build_arg_value(flag, dflt)`` — the ``--name value`` / ``--name=value`` argument, or ``dflt``. .. _call-macro-build_const-build_int: .. das:attribute:: build_int ``build_int(flag, env, dflt)`` — both-carrier integer; a garbage value on either carrier is a compile error. .. _call-macro-build_const-build_has_arg: .. das:attribute:: build_has_arg ``build_has_arg(flag)`` — true when ``flag`` appears verbatim on the command line. .. _call-macro-build_const-build_env_int: .. das:attribute:: build_env_int ``build_env_int(name, dflt)`` — integer env value; set-but-empty is ``dflt``, garbage is a compile error. .. _call-macro-build_const-build_env_value: .. das:attribute:: build_env_value ``build_env_value(name, dflt)`` — the environment value, or ``dflt`` when unset or empty. .. _call-macro-build_const-build_value: .. das:attribute:: build_value ``build_value(flag, env, dflt)`` — both-carrier string: command line beats environment beats ``dflt``.