.. _stdlib_builtin: ================ Built-in runtime ================ .. das:module:: builtin The BUILTIN module contains core runtime functions available in all daslang programs without explicit ``require``. It includes: - Heap and memory management (``heap_bytes_allocated``, ``heap_report``, ``memory_report``) - Debug output (``print``, ``debug``, ``stackwalk``) - Panic and error handling (``panic``, ``terminate``, ``assert``) - Pointer and memory operations (``intptr``, ``malloc``, ``free``) - Profiling (``profile``) - Type conversion (``string``) All functions and symbols are in "builtin" module, use require to get access to it. .. code-block:: das require builtin Example: .. code-block:: das [export] def main() { print("hello, world!\n") assert(1 + 1 == 2) let s = string(42) print("string(42) = {s}\n") let name = "daslang" print("welcome to {name}\n") var arr : array arr |> push(10) arr |> push(20) print("length = {length(arr)}\n") print("arr[0] = {arr[0]}\n") } // output: // hello, world! // string(42) = 42 // welcome to daslang // length = 2 // arr[0] = 10 ++++++++++++ Type aliases ++++++++++++ .. _alias-print_flags: .. das:attribute:: bitfield print_flags This bitfield specifies how exactly values are to be printed :Fields: * **escapeString** (0x1) - if string is to be escaped * **namesAndDimensions** (0x2) - names of the fields and dimensions of the arrays * **typeQualifiers** (0x4) - type qualifiers for the specific types like double and uint64 * **refAddresses** (0x8) - addresses in hexadecimal of each reference value * **singleLine** (0x10) - human readable vs single line * **fixedPoint** (0x20) - always output fixed point precision for floating point values * **fullTypeInfo** (0x40) - show full type info on containers (e.g. ``array`` instead of ``[]``, ``fixed_array`` instead of ``[]``, ``table`` instead of ``{}``, ``tuple`` instead of ``()``) +++++++++ Constants +++++++++ .. _global-builtin-DAS_MAX_FUNCTION_ARGUMENTS: .. das:attribute:: DAS_MAX_FUNCTION_ARGUMENTS = 32 Maximum number of arguments a function can accept, used to pre-allocate stack space for function call arguments. .. _global-builtin-INT_MIN: .. das:attribute:: INT_MIN = -2147483648 Minimum representable value of a signed 32-bit integer (`int`), equal to -2147483648. .. _global-builtin-INT_MAX: .. das:attribute:: INT_MAX = 2147483647 Maximum representable value of a signed 32-bit integer (`int`), equal to 2147483647. .. _global-builtin-UINT_MAX: .. das:attribute:: UINT_MAX = 0xffffffff Maximum representable value of an unsigned 32-bit integer (`uint`), equal to 4294967295. .. _global-builtin-LONG_MIN: .. das:attribute:: LONG_MIN = -9223372036854775808 Minimum representable value of a signed 64-bit integer (`int64`). .. _global-builtin-LONG_MAX: .. das:attribute:: LONG_MAX = 9223372036854775807 Maximum representable value of a signed 64-bit integer (`int64`). .. _global-builtin-ULONG_MAX: .. das:attribute:: ULONG_MAX = 0xffffffffffffffff Maximum representable value of an unsigned 64-bit integer (`uint64`). .. _global-builtin-FLT_MIN: .. das:attribute:: FLT_MIN = 1.1754944e-38f Smallest positive non-zero normalized value of the `float` type; for the most negative value use `-FLT_MAX`. .. _global-builtin-FLT_MAX: .. das:attribute:: FLT_MAX = 3.4028235e+38f Maximum finite representable value of the `float` (32-bit floating-point) type. .. _global-builtin-DBL_MIN: .. das:attribute:: DBL_MIN = 2.2250738585072014e-308lf Smallest positive non-zero normalized value of the `double` type; for the most negative value use `-DBL_MAX`. .. _global-builtin-DBL_MAX: .. das:attribute:: DBL_MAX = 1.7976931348623157e+308lf Maximum finite representable value of the `double` (64-bit floating-point) type. .. _global-builtin-LOG_CRITICAL: .. das:attribute:: LOG_CRITICAL = 50000 Log level constant for critical errors such as panics, fatal failures, and shutdown notifications. .. _global-builtin-LOG_ERROR: .. das:attribute:: LOG_ERROR = 40000 Log level constant for recoverable error conditions that do not require immediate shutdown. .. _global-builtin-LOG_WARNING: .. das:attribute:: LOG_WARNING = 30000 Log level constant for warnings about potential problems, API misuse, or non-fatal error conditions. .. _global-builtin-LOG_INFO: .. das:attribute:: LOG_INFO = 20000 Log level constant for general informational messages about normal program operation. .. _global-builtin-LOG_DEBUG: .. das:attribute:: LOG_DEBUG = 10000 Log level constant for debug-level diagnostic messages useful during development. .. _global-builtin-LOG_TRACE: .. das:attribute:: LOG_TRACE = 0 Log level constant for the most verbose tracing and diagnostic output, typically used for detailed debugging. .. _global-builtin-VEC_SEP: .. das:attribute:: VEC_SEP = "," Read-only string constant used as the separator between vector components when printing; defaults to `","`. .. _global-builtin-print_flags_debugger: .. das:attribute:: print_flags_debugger = bitfield(0xf) Predefined set of print_flags configured to match the output formatting used by the `debug` function. ++++++++++++++++++ Handled structures ++++++++++++++++++ .. _handle-builtin-HashBuilder: .. das:attribute:: HashBuilder Helper structure to facilitate calculating hash values. ++++++++++++++++++++ Function annotations ++++++++++++++++++++ .. _handle-builtin-type_function: .. das:attribute:: type_function Marks a function as a type function, meaning it operates on types at compile time and does not generate runtime code. .. _handle-builtin-hybrid: .. das:attribute:: hybrid Marks a function as a hybrid call target so that AOT generates indirect calls to it, allowing the function to be patched without recompiling dependent AOT code. .. _handle-builtin-builtin_array_sort: .. das:attribute:: builtin_array_sort Internal function annotation that provides the sorting implementation used by the built-in `sort` function. .. _handle-builtin-unsafe_outside_of_for: .. das:attribute:: unsafe_outside_of_for Marks a function as unsafe to call outside of a source-level `for` loop, enforcing iterator-context usage. .. _handle-builtin-never_alias_cmres: .. das:attribute:: never_alias_cmres Declares that the function never aliases cmres (copy-or-move result), disabling aliasing safety checks for the return value. .. _handle-builtin-deprecated: .. das:attribute:: deprecated Marks a function as deprecated, causing a compilation warning when referenced and excluding it from the final compiled context. .. _handle-builtin-init: .. das:attribute:: init Registers a function to be called automatically during context initialization, before any user code runs. .. _handle-builtin-jit: .. das:attribute:: jit Explicitly forces the annotated function to be compiled using the JIT compiler, overriding default compilation decisions. .. _handle-builtin-no_aot: .. das:attribute:: no_aot Prevents ahead-of-time (AOT) C++ code generation for the annotated function, keeping it interpreted only. .. _handle-builtin-hint: .. das:attribute:: hint Provides optimization hints to the compiler for the annotated function via annotation arguments. .. _handle-builtin-unsafe_deref: .. das:attribute:: unsafe_deref Optimization annotation that removes null-pointer checks, bounds checks on array and string indexing, and similar safety validations. .. _handle-builtin-local_only: .. das:attribute:: local_only Restricts a function to accept only local `make` expressions such as structure initializers and tuple constructors. .. _handle-builtin-unused_argument: .. das:attribute:: unused_argument Suppresses unused-argument warnings or errors for specific function parameters, providing a workaround when strict code policies are enabled. .. _handle-builtin-marker: .. das:attribute:: marker Attaches arbitrary key-value annotation arguments to a function, typically used by macros to tag functions with metadata. .. _handle-builtin-unsafe_when_not_clone_array: .. das:attribute:: unsafe_when_not_clone_array Marks a function as unsafe to call outside of an array `clone` operation, restricting its usage context. .. _handle-builtin-run: .. das:attribute:: run Forces the function to be evaluated at compile time, ensuring its body executes during compilation rather than at runtime. .. _handle-builtin-expect_dim: .. das:attribute:: expect_dim Contract annotation requiring a function argument to be a fixed-size (statically dimensioned) array. .. _handle-builtin-finalize: .. das:attribute:: finalize Registers a function to be called automatically when the context is shut down, for cleanup and resource release. .. _handle-builtin-nodiscard: .. das:attribute:: nodiscard Enforces that the return value of the function must be used by the caller; discarding the result produces a compilation error. .. _handle-builtin-pinvoke: .. das:attribute:: pinvoke Marks a function as a platform invoke (pinvoke) entry, enabling cross-context calls via ``invoke_in_context``, ``invoke_debug_agent_method``, and ``invoke_debug_agent_function``. The annotation adds a context mutex so the function can be safely invoked from another context (including the single thread-local agent context when the category is ``""``). Functions called cross-context must also be marked ``[export]``. .. _handle-builtin-generic: .. das:attribute:: generic Forces a function to be treated as generic regardless of its argument types, causing it to be instanced in each calling module. .. _handle-builtin-expect_any_vector: .. das:attribute:: expect_any_vector Contract annotation restricting a function argument to accept only `das::vector` template types. .. _handle-builtin-no_jit: .. das:attribute:: no_jit Prevents JIT compilation for the annotated function, forcing it to run in interpreted mode. .. _handle-builtin-export: .. das:attribute:: export Forces a function to be exported and retained in the final compiled context, even if it is not directly called. .. _handle-builtin-macro_function: .. das:attribute:: macro_function Marks a function as part of the macro subsystem, excluding it from the final compiled context unless it is explicitly referenced. .. _handle-builtin-_macro: .. das:attribute:: _macro Marks a function to be executed during the macro compilation pass, similar to `[init]` but running at macro time. .. _handle-builtin-sideeffects: .. das:attribute:: sideeffects Declares that the function has side effects, preventing the compiler from optimizing away or reordering its calls. .. _handle-builtin-unsafe_operation: .. das:attribute:: unsafe_operation Marks a function as an unsafe operation, requiring callers to wrap the call in an `unsafe` block. .. _handle-builtin-expect_ref: .. das:attribute:: expect_ref Contract annotation requiring a function argument to be passed by reference. .. _handle-builtin-alias_cmres: .. das:attribute:: alias_cmres Declares that the function always aliases cmres (copy-or-move result), disabling cmres return optimizations for it. .. _handle-builtin-no_lint: .. das:attribute:: no_lint Skips all lint-pass checks for the annotated function, suppressing any lint warnings or errors it would produce. +++++++++++ Call macros +++++++++++ .. _call-macro-builtin-static_assert: .. das:attribute:: static_assert Compile-time assertion that produces a compilation error with an optional message when the condition is false. .. _call-macro-builtin-__builtin_table_key_exists: .. das:attribute:: __builtin_table_key_exists Internal function annotation that implements the low-level key presence check for the `key_exists` operation. .. _call-macro-builtin-make_function_unsafe: .. das:attribute:: make_function_unsafe Propagates the `unsafe` requirement to the calling function, making any function that calls it also require an `unsafe` block. .. _call-macro-builtin-__builtin_table_find: .. das:attribute:: __builtin_table_find Internal function annotation that implements the low-level table lookup for the `find` operation. .. _call-macro-builtin-debug: .. das:attribute:: debug Prints the human-readable representation of a value to the log and returns that same value, allowing inline debugging in expressions. .. _call-macro-builtin-invoke: .. das:attribute:: invoke Invokes a block, function pointer, or lambda, dispatching the call through the appropriate calling convention. .. _call-macro-builtin-memzero: .. das:attribute:: memzero Fills a region of memory with zeros, used internally for default-initializing values. .. _call-macro-builtin-verify: .. das:attribute:: verify Assertion that preserves the evaluated expression even when asserts are disabled, ensuring side effects are never optimized out. .. _call-macro-builtin-assert: .. das:attribute:: assert Runtime assertion that panics with an optional error message when the first argument evaluates to false; can be disabled globally. .. _call-macro-builtin-concept_assert: .. das:attribute:: concept_assert Compile-time assertion that reports the error at the call site of the asserted function rather than at the assert line itself. .. _call-macro-builtin-__builtin_table_set_insert: .. das:attribute:: __builtin_table_set_insert Internal function annotation that implements the low-level key insertion for set-style tables (tables with keys only). .. _call-macro-builtin-__builtin_table_erase: .. das:attribute:: __builtin_table_erase Internal function annotation that implements the low-level table entry removal for the `erase` operation. +++++++++++++ Reader macros +++++++++++++ .. _call-macro-builtin-_esc: .. das:attribute:: _esc Reader macro that returns the raw string content without processing escape sequences, e.g. `%_esc~\n\r~%_esc` yields the literal four characters `\`, `n`, `\`, `r`. +++++++++++++++ Typeinfo macros +++++++++++++++ .. _call-macro-builtin-rtti_classinfo: .. das:attribute:: rtti_classinfo Typeinfo macro that generates RTTI `TypeInfo` metadata required for class initialization and reflection. +++++++++++++ Handled types +++++++++++++ .. _handle-builtin-das_string: .. das:attribute:: das_string Handled type wrapping `das::string` (typically `std::string`), providing heap-allocated mutable string storage. .. _handle-builtin-clock: .. das:attribute:: clock Handled type wrapping `das::Time`, which encapsulates the C `time_t` value for calendar time representation. ++++++++++++++++ Structure macros ++++++++++++++++ .. _handle-builtin-comment: .. das:attribute:: comment No-op structure annotation that holds annotation arguments as metadata without affecting code generation. .. _handle-builtin-cpp_layout: .. das:attribute:: cpp_layout Forces the structure to use C++ memory layout rules (alignment and padding) instead of native daslang layout. .. _handle-builtin-macro_interface: .. das:attribute:: macro_interface Marks a class hierarchy as a macro interface, preventing it and its descendants from being exported by default. .. _handle-builtin-no_default_initializer: .. das:attribute:: no_default_initializer Prevents the compiler from generating a default initializer for the annotated structure. .. _handle-builtin-safe_when_uninitialized: .. das:attribute:: safe_when_uninitialized Declares that the structure is safe to access before explicit initialization, suppressing uninitialized-use errors. .. _handle-builtin-persistent: .. das:attribute:: persistent Allocates the structure on the C++ heap (via `new`) instead of the daslang context heap, allowing it to outlive the context. ++++++++++ Containers ++++++++++ * :ref:`back (var a: array\) : TT& ` * :ref:`back (a: array\) : TT ` * :ref:`back (var a: array\#) : TT&# ` * :ref:`back (a: array\#) : TT const&# ` * :ref:`back (arr: auto(TT) ==const) : auto ` * :ref:`back (var arr: auto(TT) ==const) : auto& ` * :ref:`capacity (table: table\) : int ` * :ref:`capacity (array: array\) : int ` * :ref:`clear (array: array\) ` * :ref:`clear (var t: table\) : auto ` * :ref:`copy_to_local (a: auto(TT)) : TT ` * :ref:`each (lam: lambda\<(var arg:auto(argT)):bool\>) : iterator\ ` * :ref:`each (rng: urange) : iterator\ ` * :ref:`each (a: array\) : iterator\ ` * :ref:`each (a: array\#) : iterator\ ` * :ref:`each (str: string) : iterator\ ` * :ref:`each (rng: urange64) : iterator\ ` * :ref:`each (a: auto(TT)[]) : iterator\ ` * :ref:`each (rng: range64) : iterator\ ` * :ref:`each (rng: range) : iterator\ ` * :ref:`each_enum (tt: auto(TT)) : iterator\ ` * :ref:`each_ref (lam: lambda\<(var arg:auto(argT)?):bool\>) : iterator\ ` * :ref:`emplace (var Tab: table\; key: auto; value: auto) : auto ` * :ref:`emplace (var Arr: array\; var value: numT&; at: int) : auto ` * :ref:`emplace (var Arr: array\; var value: numT&) : auto ` * :ref:`emplace (var a: array\; value: auto) : auto ` * :ref:`emplace (var Tab: table\\>; at: keyT|keyT#; var val: smart_ptr\&) : auto ` * :ref:`emplace (var Tab: table\; at: keyT|keyT#; var val: valT[]&) : auto ` * :ref:`emplace (var Tab: table\; at: keyT|keyT#; var val: valT&) : auto ` * :ref:`emplace (var Arr: array\; var value: numT[]) : auto ` * :ref:`emplace (var Arr: array\; var value: numT[]) : auto ` * :ref:`emplace_default (var tab: table\; key: keyT|keyT#) ` * :ref:`emplace_new (var Arr: array\\>; var value: smart_ptr\) : auto ` * :ref:`emplace_new (var tab: table\\>; key: kT; var value: smart_ptr\) : auto ` * :ref:`empty (a: table\|table\#) : bool ` * :ref:`empty (str: string) : bool ` * :ref:`empty (str: das_string) : bool ` * :ref:`empty (a: array\|array\#) : bool ` * :ref:`empty (iterator: iterator) : bool ` * :ref:`erase (var Tab: table\; at: keyT|keyT#) : bool ` * :ref:`erase (var Arr: array\; at: int) : auto ` * :ref:`erase (var Arr: array\; at: int; count: int) : auto ` * :ref:`erase (var Tab: table\; at: string#) : bool ` * :ref:`erase_if (var arr: array\; blk: block\<(key:TT const):bool\>|block\<(var key:TT&):bool\>) : auto ` * :ref:`find_index (arr: array\|array\#; key: TT) : auto ` * :ref:`find_index (arr: auto(TT)[]|auto(TT)[]#; key: TT) : auto ` * :ref:`find_index (var arr: iterator\; key: TT) : auto ` * :ref:`find_index_if (arr: auto(TT)[]|auto(TT)[]#; blk: block\<(key:TT):bool\>) : auto ` * :ref:`find_index_if (arr: array\|array\#; blk: block\<(key:TT):bool\>) : auto ` * :ref:`find_index_if (var arr: iterator\; blk: block\<(key:TT):bool\>) : auto ` * :ref:`get (var Tab: table\; at: keyT|keyT#; blk: block\<(var p:valT&):void\>) : auto ` * :ref:`get (Tab: table\; at: keyT|keyT#; blk: block\<(p:valT):void\>) : auto ` * :ref:`get (Tab: table\#; at: keyT|keyT#; blk: block\<(p:valT const&#):void\>) : auto ` * :ref:`get (Tab: table\; at: keyT|keyT#; blk: block\<(p:valT const[-2]&):void\>) : auto ` * :ref:`get (Tab: table\; at: keyT|keyT#; blk: block\<(var p:void?):void\>) : auto ` * :ref:`get (var Tab: table\#; at: keyT|keyT#; blk: block\<(var p:valT&#):void\>) : auto ` * :ref:`get (Tab: table\#; at: keyT|keyT#; blk: block\<(p:valT const[-2]&#):void\>) : auto ` * :ref:`get (var Tab: table\#; at: keyT|keyT#; blk: block\<(var p:valT[-2]&#):void\>) : auto ` * :ref:`get (var Tab: table\; at: keyT|keyT#; blk: block\<(var p:valT[-2]&):void\>) : auto ` * :ref:`get_key (a: table\; value: auto) : auto ` * :ref:`get_key (a: table\; value: valT const[-2]) : keyT ` * :ref:`get_key (a: table\; value: valT) : keyT ` * :ref:`get_value (var Tab: table\; at: keyT|keyT#) : valT[-2] ` * :ref:`get_value (var Tab: table\; at: keyT|keyT#) : valT ` * :ref:`get_value (Tab: table\; at: keyT|keyT#) : valT ` * :ref:`get_value (var Tab: table\\>; at: keyT|keyT#) : smart_ptr\ ` * :ref:`get_with_default (var Tab: table\; at: keyT|keyT#; blk: block\<(var p:valT&):void\>) ` * :ref:`has_value (var a: iterator\; key: auto) : auto ` * :ref:`has_value (a: auto; key: auto) : auto ` * :ref:`insert (var Tab: table\; at: keyT|keyT#) : auto ` * :ref:`insert (var Tab: table\; at: keyT|keyT#; val: valT const[] ==const|valT const[]# ==const) : auto ` * :ref:`insert (var Tab: table\; at: keyT|keyT#; val: valT ==const|valT const# ==const) : auto ` * :ref:`insert (var Tab: table\; at: keyT|keyT#; var val: valT ==const|valT# ==const) : auto ` * :ref:`insert (var Tab: table\; at: keyT|keyT#; var val: valT[] ==const|valT[]# ==const) : auto ` * :ref:`insert_clone (var Tab: table\; at: keyT|keyT#; var val: valT ==const|valT# ==const) : auto ` * :ref:`insert_clone (var Tab: table\; at: keyT|keyT#; val: valT const[] ==const|valT const[]# ==const) : auto ` * :ref:`insert_clone (var Tab: table\; at: keyT|keyT#; var val: valT[] ==const|valT[]# ==const) : auto ` * :ref:`insert_clone (var Tab: table\; at: keyT|keyT#; val: valT ==const|valT const# ==const) : auto ` * :ref:`insert_default (var tab: table\; key: keyT|keyT#) ` * :ref:`insert_default (var tab: table\; key: TT|TT#; var value: QQ ==const|QQ# ==const) ` * :ref:`insert_default (var tab: table\; key: keyT|keyT#; value: valT ==const|valT const# ==const) ` * :ref:`key_exists (Tab: table\|table\#; at: string#) : bool ` * :ref:`key_exists (Tab: table\|table\#; at: keyT|keyT#) : bool ` * :ref:`keys (var a: table\ ==const|table\# ==const) : iterator\ ` * :ref:`keys (a: table\ ==const|table\ const# ==const) : iterator\ ` * :ref:`length (a: auto|auto#) : int ` * :ref:`length (array: array\) : int ` * :ref:`length (table: table\) : int ` * :ref:`lock (Tab: table\|table\#; blk: block\<(t:table\#):void\>) : auto ` * :ref:`lock (var a: array\ ==const|array\# ==const; blk: block\<(var x:array\#):auto\>) : auto ` * :ref:`lock (a: array\ ==const|array\ const# ==const; blk: block\<(x:array\#):auto\>) : auto ` * :ref:`lock_forever (var Tab: table\|table\#) : table\# ` * :ref:`modify (var Tab: table\; at: keyT|keyT#; blk: block\<(p:valT):valT\>) ` * :ref:`move_to_local (var a: auto(TT)&) : TT ` * :ref:`move_to_ref (var a: auto&; var b: auto) : auto ` * :ref:`next (var it: iterator\; var value: TT&) : bool ` * :ref:`nothing (var it: iterator\) : iterator\ ` * :ref:`pop (var Arr: array\) : auto ` * :ref:`push (var Arr: array\; varr: numT const[] ==const) : auto ` * :ref:`push (var Arr: array\; varr: numT[]) : auto ` * :ref:`push (var Arr: array\; var varr: numT[] ==const) : auto ` * :ref:`push (var Arr: array\; varr: array\) : auto ` * :ref:`push (var Arr: array\; value: numT ==const) : auto ` * :ref:`push (var Arr: array\; var value: numT ==const; at: int) : auto ` * :ref:`push (var Arr: array\; var value: numT ==const) : auto ` * :ref:`push (var Arr: array\; var varr: array\) : auto ` * :ref:`push (var Arr: array\; value: numT ==const; at: int) : auto ` * :ref:`push_clone (var A: auto(CT); b: auto(TT)|auto(TT)#) : auto ` * :ref:`push_clone (var Arr: array\; var varr: numT[]) : auto ` * :ref:`push_clone (var Arr: array\; varr: numT const[] ==const) : auto ` * :ref:`push_clone (var Arr: array\; var value: numT ==const|numT# ==const) : auto ` * :ref:`push_clone (var Arr: array\; var varr: numT[] ==const) : auto ` * :ref:`push_clone (var Arr: array\; var value: numT ==const|numT# ==const; at: int) : auto ` * :ref:`push_clone (var Arr: array\; value: numT ==const|numT const# ==const; at: int) : auto ` * :ref:`push_clone (var Arr: array\; value: numT ==const|numT const# ==const) : auto ` * :ref:`push_clone (var Arr: array\; varr: numT const[] ==const) : auto ` * :ref:`remove_value (var arr: array\|array\#; key: TT) : bool ` * :ref:`reserve (var Tab: table\; newSize: int) : auto ` * :ref:`reserve (var Arr: array\; newSize: int) : auto ` * :ref:`resize (var Arr: array\; newSize: int) : auto ` * :ref:`resize_and_init (var Arr: array\; newSize: int; initValue: numT) : auto ` * :ref:`resize_and_init (var Arr: array\; newSize: int) : auto ` * :ref:`resize_no_init (var Arr: array\; newSize: int) : auto ` * :ref:`sort (var a: array\|array\#) : auto ` * :ref:`sort (var a: auto(TT)[]|auto(TT)[]#; cmp: block\<(x:TT;y:TT):bool\>) : auto ` * :ref:`sort (var a: auto(TT)[]|auto(TT)[]#) : auto ` * :ref:`sort (var a: array\|array\#; cmp: block\<(x:TT;y:TT):bool\>) : auto ` * :ref:`subarray (a: array\; r: urange) : auto ` * :ref:`subarray (a: auto(TT)[]; r: range) : auto ` * :ref:`subarray (a: array\; r: range) : auto ` * :ref:`subarray (a: auto(TT)[]; r: urange) : auto ` * :ref:`subarray (var a: array\; r: range) : auto ` * :ref:`to_array (a: auto(TT)[]) : array\ ` * :ref:`to_array (var it: iterator\) : array\ ` * :ref:`to_array_move (var a: auto(TT) ==const) : array\ ` * :ref:`to_array_move (var a: auto(TT)[]) : array\ ` * :ref:`to_array_move (a: auto(TT) ==const) : array\ ` * :ref:`to_table (a: tuple\[]) : table\ ` * :ref:`to_table (a: auto(keyT)[]) : table\ ` * :ref:`to_table_move (var a: tuple\[]) : table\ ` * :ref:`to_table_move (var a: array\\>) : table\ ` * :ref:`to_table_move (var a: tuple\) : table\ ` * :ref:`to_table_move (a: array\) : table\ ` * :ref:`to_table_move (a: auto(keyT)[]) : table\ ` * :ref:`to_table_move (a: auto(keyT)) : table\ ` * :ref:`values (var a: table\ ==const|table\# ==const) : iterator\ ` * :ref:`values (a: table\ ==const|table\ const# ==const) : iterator\ ` * :ref:`values (a: table\ ==const|table\ const# ==const) : iterator\ ` * :ref:`values (a: table\ ==const|table\ const# ==const) : auto ` * :ref:`values (var a: table\ ==const|table\# ==const) : auto ` * :ref:`values (var a: table\ ==const|table\# ==const) : iterator\ ` back ^^^^ .. _function-builtin_back__array_ls_autoTT_gr_: .. das:function:: back(a: array) : TT& Accesses and returns a mutable reference to the last element of the dynamic array `a`. :Arguments: * **a** : array! .. _function-builtin_back_array_ls_autoTT_gr_: .. das:function:: back(a: array) : TT .. _function-builtin_back__array_ls_autoTT_gr__hh_: .. das:function:: back(a: array#) : TT&# .. _function-builtin_back_array_ls_autoTT_gr__hh_: .. das:function:: back(a: array#) : TT const&# .. _function-builtin_back_autoTT__eq__eq_const_0x1a6: .. das:function:: back(arr: auto(TT) ==const) : auto .. _function-builtin_back__autoTT__eq__eq_const_0x19b: .. das:function:: back(arr: auto(TT) ==const) : auto& ---- capacity ^^^^^^^^ .. _function-builtin_capacity_table_ls_anything,_anything_gr_: .. das:function:: capacity(table: table) : int Returns the current capacity of the `table` — the number of key-value pairs it can hold before triggering a reallocation. :Arguments: * **table** : table implicit .. _function-builtin_capacity_array_ls_anything_gr_: .. das:function:: capacity(array: array) : int ---- clear ^^^^^ .. _function-builtin_clear_array_ls_anything_gr_: .. das:function:: clear(array: array) Removes all elements from the dynamic `array`, leaving it empty with a size of 0. :Arguments: * **array** : array implicit .. _function-builtin_clear_table_ls_autoKT,_autoVT_gr_: .. das:function:: clear(t: table) : auto ---- .. _function-builtin_copy_to_local_autoTT_0x38a: .. das:function:: copy_to_local(a: auto(TT)) : TT Copies the value `a` and returns it as a new local value on the stack, which can be used to work around aliasing issues where a reference might be invalidated. :Arguments: * **a** : auto(TT) each ^^^^ .. _function-builtin_each_lambda_ls_var_arg_c_autoargT_c_bool_gr_: .. das:function:: each(lam: lambda<(var arg:auto(argT)):bool>) : iterator Creates an iterator from a lambda. The lambda is called repeatedly; each invocation receives a mutable argument and returns `true` to continue or `false` to stop. :Arguments: * **lam** : lambda<(arg:auto(argT)):bool> .. _function-builtin_each_urange: .. das:function:: each(rng: urange) : iterator .. _function-builtin_each_array_ls_autoTT_gr_: .. das:function:: each(a: array) : iterator .. _function-builtin_each_array_ls_autoTT_gr__hh_: .. das:function:: each(a: array#) : iterator .. _function-builtin_each_string: .. das:function:: each(str: string) : iterator .. _function-builtin_each_urange64: .. das:function:: each(rng: urange64) : iterator .. _function-builtin_each_autoTT_lb__rb__0x52e: .. das:function:: each(a: auto(TT)[]) : iterator .. _function-builtin_each_range64: .. das:function:: each(rng: range64) : iterator .. _function-builtin_each_range: .. das:function:: each(rng: range) : iterator ---- .. _function-builtin_each_enum_autoTT_0x55b: .. das:function:: each_enum(tt: auto(TT)) : iterator .. warning:: This function is deprecated. Creates an iterator that yields every value of the enumeration type inferred from `tt`, allowing iteration over all members of an enum. :Arguments: * **tt** : auto(TT) .. _function-builtin_each_ref_lambda_ls_var_arg_c_autoargT_q__c_bool_gr_: .. das:function:: each_ref(lam: lambda<(var arg:auto(argT)?):bool>) : iterator Wraps a lambda `lam` — which receives a mutable pointer argument and returns a bool indicating whether to continue — into an iterator that yields references to each value rather than copies. :Arguments: * **lam** : lambda<(arg:auto(argT)?):bool> emplace ^^^^^^^ .. _function-builtin_emplace_table_ls_auto,_auto_gr__auto_auto_0x315: .. das:function:: emplace(Tab: table; key: auto; value: auto) : auto Moves `value` into the table `Tab` under `key` using move semantics. If the key already exists, its value is replaced. :Arguments: * **Tab** : table * **key** : auto * **value** : auto .. _function-builtin_emplace_array_ls_autonumT_gr__numT_ref__int: .. das:function:: emplace(Arr: array; value: numT&; at: int) : auto .. _function-builtin_emplace_array_ls_autonumT_gr__numT_ref_: .. das:function:: emplace(Arr: array; value: numT&) : auto .. _function-builtin_emplace_array_ls_auto_gr__auto_0x322: .. das:function:: emplace(a: array; value: auto) : auto .. _function-builtin_emplace_table_ls_autokeyT,_smart_ptr_ls_autovalT_gr__gr__keyTkeyT_hh__smart_ptr_ls_valT_gr__ref_: .. das:function:: emplace(Tab: table>; at: keyT|keyT#; val: smart_ptr&) : auto .. _function-builtin_emplace_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__valT_lb__rb__ref_: .. das:function:: emplace(Tab: table; at: keyT|keyT#; val: valT[]&) : auto .. _function-builtin_emplace_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__valT_ref_: .. das:function:: emplace(Tab: table; at: keyT|keyT#; val: valT&) : auto .. _function-builtin_emplace_array_ls_autonumT_gr__numT_lb__rb_: .. das:function:: emplace(Arr: array; value: numT[]) : auto .. _function-builtin_emplace_array_ls_autonumT_lb__rb__gr__numT_lb__rb_: .. das:function:: emplace(Arr: array; value: numT[]) : auto ---- .. _function-builtin_emplace_default_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh_: .. das:function:: emplace_default(tab: table; key: keyT|keyT#) Constructs a new default-initialized element in the table `tab` at the given `key`, only if that key does not already exist. :Arguments: * **tab** : table * **key** : option emplace_new ^^^^^^^^^^^ .. _function-builtin_emplace_new_array_ls_smart_ptr_ls_autonumT_gr__gr__smart_ptr_ls_numT_gr_: .. das:function:: emplace_new(Arr: array>; value: smart_ptr) : auto Moves a smart pointer `value` into the end of the array `Arr`, constructing the entry in-place and returning a reference to it. :Arguments: * **Arr** : array> * **value** : smart_ptr .. _function-builtin_emplace_new_table_ls_autokT,_smart_ptr_ls_autovT_gr__gr__kT_smart_ptr_ls_vT_gr_: .. das:function:: emplace_new(tab: table>; key: kT; value: smart_ptr) : auto ---- empty ^^^^^ .. _function-builtin_empty_table_ls_auto;auto_gr_table_ls_auto;auto_gr__hh_: .. das:function:: empty(a: table|table#) : bool Checks whether the table `a` has no entries and returns `true` if so. :Arguments: * **a** : option\ | table\ #> .. _function-builtin_empty_string: .. das:function:: empty(str: string) : bool .. _function-builtin_empty_das_string: .. das:function:: empty(str: das_string) : bool .. _function-builtin_empty_array_ls_auto_gr_array_ls_auto_gr__hh_: .. das:function:: empty(a: array|array#) : bool .. _function-builtin_empty_iterator: .. das:function:: empty(iterator: iterator) : bool ---- erase ^^^^^ .. _function-builtin_erase_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh_: .. das:function:: erase(Tab: table; at: keyT|keyT#) : bool Removes the entry with key `at` from the table `Tab`, returning `true` if the key was found and erased. :Arguments: * **Tab** : table * **at** : option .. _function-builtin_erase_array_ls_autonumT_gr__int: .. das:function:: erase(Arr: array; at: int) : auto .. _function-builtin_erase_array_ls_autonumT_gr__int_int: .. das:function:: erase(Arr: array; at: int; count: int) : auto .. _function-builtin_erase_table_ls_autokeyT,_autovalT_gr__string_hh_: .. das:function:: erase(Tab: table; at: string#) : bool ---- .. _function-builtin_erase_if_array_ls_autoTT_gr__block_ls_key_c_TT_const_c_bool_gr_block_ls_var_key_c_TT_ref__c_bool_gr_: .. das:function:: erase_if(arr: array; blk: block<(key:TT const):bool>|block<(var key:TT&):bool>) : auto Iterates over the array `arr` and removes all elements for which the block `blk` returns `true`. :Arguments: * **arr** : array * **blk** : option\ | block<(key:TT\ &):bool>> find_index ^^^^^^^^^^ .. _function-builtin_find_index_array_ls_autoTT_gr_array_ls_autoTT_gr__hh__TT: .. das:function:: find_index(arr: array|array#; key: TT) : auto Searches the dynamic array `arr` for the first occurrence of `key` and returns its index, or -1 if not found. :Arguments: * **arr** : option\ | array\ #> * **key** : TT .. _function-builtin_find_index_autoTT_lb__rb_autoTT_lb__rb__hh__TT: .. das:function:: find_index(arr: auto(TT)[]|auto(TT)[]#; key: TT) : auto .. _function-builtin_find_index_iterator_ls_autoTT_gr__TT: .. das:function:: find_index(arr: iterator; key: TT) : auto ---- find_index_if ^^^^^^^^^^^^^ .. _function-builtin_find_index_if_autoTT_lb__rb_autoTT_lb__rb__hh__block_ls_key_c_TT_c_bool_gr_: .. das:function:: find_index_if(arr: auto(TT)[]|auto(TT)[]#; blk: block<(key:TT):bool>) : auto Returns the index of the first element in the fixed array `arr` for which `blk` returns `true`, or -1 if no element matches. :Arguments: * **arr** : option * **blk** : block<(key:TT):bool> .. _function-builtin_find_index_if_array_ls_autoTT_gr_array_ls_autoTT_gr__hh__block_ls_key_c_TT_c_bool_gr_: .. das:function:: find_index_if(arr: array|array#; blk: block<(key:TT):bool>) : auto .. _function-builtin_find_index_if_iterator_ls_autoTT_gr__block_ls_key_c_TT_c_bool_gr_: .. das:function:: find_index_if(arr: iterator; blk: block<(key:TT):bool>) : auto ---- get ^^^ .. _function-builtin_get__table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__block_ls_var_p_c_valT_ref__c_void_gr_: .. das:function:: get(Tab: table; at: keyT|keyT#; blk: block<(var p:valT&):void>) : auto Looks up `at` in the table `Tab` and, if found, invokes `blk` with a mutable reference to the value; returns `true` if the key existed, `false` otherwise. :Arguments: * **Tab** : table! * **at** : option * **blk** : block<(p:valT\ &):void> .. _function-builtin_get_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__block_ls_p_c_valT_c_void_gr_: .. das:function:: get(Tab: table; at: keyT|keyT#; blk: block<(p:valT):void>) : auto .. _function-builtin_get_table_ls_autokeyT,_autovalT_gr__hh__keyTkeyT_hh__block_ls_p_c_valT_const_ref__hh__c_void_gr_: .. das:function:: get(Tab: table#; at: keyT|keyT#; blk: block<(p:valT const&#):void>) : auto .. _function-builtin_get_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__block_ls_p_c_valT_const_lb_-2_rb__ref__c_void_gr_: .. das:function:: get(Tab: table; at: keyT|keyT#; blk: block<(p:valT const[-2]&):void>) : auto .. _function-builtin_get_table_ls_autokeyT,_void_gr__keyTkeyT_hh__block_ls_var_p_c_void_q__c_void_gr_: .. das:function:: get(Tab: table; at: keyT|keyT#; blk: block<(var p:void?):void>) : auto .. _function-builtin_get__table_ls_autokeyT,_autovalT_gr__hh__keyTkeyT_hh__block_ls_var_p_c_valT_ref__hh__c_void_gr_: .. das:function:: get(Tab: table#; at: keyT|keyT#; blk: block<(var p:valT&#):void>) : auto .. _function-builtin_get_table_ls_autokeyT,_autovalT_lb__rb__gr__hh__keyTkeyT_hh__block_ls_p_c_valT_const_lb_-2_rb__ref__hh__c_void_gr_: .. das:function:: get(Tab: table#; at: keyT|keyT#; blk: block<(p:valT const[-2]&#):void>) : auto .. _function-builtin_get__table_ls_autokeyT,_autovalT_lb__rb__gr__hh__keyTkeyT_hh__block_ls_var_p_c_valT_lb_-2_rb__ref__hh__c_void_gr_: .. das:function:: get(Tab: table#; at: keyT|keyT#; blk: block<(var p:valT[-2]&#):void>) : auto .. _function-builtin_get__table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__block_ls_var_p_c_valT_lb_-2_rb__ref__c_void_gr_: .. das:function:: get(Tab: table; at: keyT|keyT#; blk: block<(var p:valT[-2]&):void>) : auto ---- get_key ^^^^^^^ .. _function-builtin_get_key_table_ls_autokeyT,_void_gr__auto_0x4aa: .. das:function:: get_key(a: table; value: auto) : auto Returns the key associated with a value reference obtained during table iteration. The value must be a reference from a ``values()`` iterator on the same table. Computes the key via O(1) pointer arithmetic on the parallel key/value arrays. Throws an error if the value pointer is not inside the table or points to a deleted slot. :Arguments: * **a** : table! * **value** : auto .. _function-builtin_get_key_table_ls_autokeyT,_autovalT_lb__rb__gr__valT_const_lb_-2_rb_: .. das:function:: get_key(a: table; value: valT const[-2]) : keyT .. _function-builtin_get_key_table_ls_autokeyT,_autovalT_gr__valT: .. das:function:: get_key(a: table; value: valT) : keyT ---- get_value ^^^^^^^^^ .. _function-builtin_get_value_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh_: .. das:function:: get_value(Tab: table; at: keyT|keyT#) : valT[-2] Retrieves the fixed-size array value associated with key `at` from the mutable table `Tab`. :Arguments: * **Tab** : table * **at** : option .. _function-builtin_get_value__table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh_: .. das:function:: get_value(Tab: table; at: keyT|keyT#) : valT .. _function-builtin_get_value_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh_: .. das:function:: get_value(Tab: table; at: keyT|keyT#) : valT .. _function-builtin_get_value_table_ls_autokeyT,_smart_ptr_ls_autovalT_gr__gr__keyTkeyT_hh_: .. das:function:: get_value(Tab: table>; at: keyT|keyT#) : smart_ptr ---- .. _function-builtin_get_with_default__table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__block_ls_var_p_c_valT_ref__c_void_gr_: .. das:function:: get_with_default(Tab: table; at: keyT|keyT#; blk: block<(var p:valT&):void>) Looks up key `at` in the table `Tab`, inserting a default-initialized entry if the key is absent, then invokes `blk` with a mutable reference to the value. :Arguments: * **Tab** : table! * **at** : option * **blk** : block<(p:valT\ &):void> has_value ^^^^^^^^^ .. _function-builtin_has_value_iterator_ls_auto_gr__auto_0x6e7: .. das:function:: has_value(a: iterator; key: auto) : auto Consumes elements from the iterator `a` and returns `true` if any element equals `key`. :Arguments: * **a** : iterator * **key** : auto .. _function-builtin_has_value_auto_auto_0x6d9: .. das:function:: has_value(a: auto; key: auto) : auto ---- insert ^^^^^^ .. _function-builtin_insert_table_ls_autokeyT,_void_gr__keyTkeyT_hh_: .. das:function:: insert(Tab: table; at: keyT|keyT#) : auto Inserts the key `at` into the set-style table `Tab` (a table with `void` values), effectively adding to a set. :Arguments: * **Tab** : table * **at** : option .. _function-builtin_insert_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__valT_const_lb__rb___eq__eq_constvalT_const_lb__rb__hh___eq__eq_const: .. das:function:: insert(Tab: table; at: keyT|keyT#; val: valT const[] ==const|valT const[]# ==const) : auto .. _function-builtin_insert_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__valT__eq__eq_constvalT_const_hh___eq__eq_const: .. das:function:: insert(Tab: table; at: keyT|keyT#; val: valT ==const|valT const# ==const) : auto .. _function-builtin_insert_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__valT__eq__eq_constvalT_hh___eq__eq_const: .. das:function:: insert(Tab: table; at: keyT|keyT#; val: valT ==const|valT# ==const) : auto .. _function-builtin_insert_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__valT_lb__rb___eq__eq_constvalT_lb__rb__hh___eq__eq_const: .. das:function:: insert(Tab: table; at: keyT|keyT#; val: valT[] ==const|valT[]# ==const) : auto ---- insert_clone ^^^^^^^^^^^^ .. _function-builtin_insert_clone_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__valT__eq__eq_constvalT_hh___eq__eq_const: .. das:function:: insert_clone(Tab: table; at: keyT|keyT#; val: valT ==const|valT# ==const) : auto Inserts or updates an entry in the table `Tab` at key `at` by cloning the mutable value `val` into the table. :Arguments: * **Tab** : table * **at** : option * **val** : option .. _function-builtin_insert_clone_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__valT_const_lb__rb___eq__eq_constvalT_const_lb__rb__hh___eq__eq_const: .. das:function:: insert_clone(Tab: table; at: keyT|keyT#; val: valT const[] ==const|valT const[]# ==const) : auto .. _function-builtin_insert_clone_table_ls_autokeyT,_autovalT_lb__rb__gr__keyTkeyT_hh__valT_lb__rb___eq__eq_constvalT_lb__rb__hh___eq__eq_const: .. das:function:: insert_clone(Tab: table; at: keyT|keyT#; val: valT[] ==const|valT[]# ==const) : auto .. _function-builtin_insert_clone_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__valT__eq__eq_constvalT_const_hh___eq__eq_const: .. das:function:: insert_clone(Tab: table; at: keyT|keyT#; val: valT ==const|valT const# ==const) : auto ---- insert_default ^^^^^^^^^^^^^^ .. _function-builtin_insert_default_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh_: .. das:function:: insert_default(tab: table; key: keyT|keyT#) Inserts a default-constructed value into the table `tab` under `key` if the key does not already exist. :Arguments: * **tab** : table * **key** : option .. _function-builtin_insert_default_table_ls_autoTT,_autoQQ_gr__TTTT_hh__QQ__eq__eq_constQQ_hh___eq__eq_const: .. das:function:: insert_default(tab: table; key: TT|TT#; value: QQ ==const|QQ# ==const) .. _function-builtin_insert_default_table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__valT__eq__eq_constvalT_const_hh___eq__eq_const: .. das:function:: insert_default(tab: table; key: keyT|keyT#; value: valT ==const|valT const# ==const) ---- key_exists ^^^^^^^^^^ .. _function-builtin_key_exists_table_ls_autokeyT;autovalT_gr_table_ls_autokeyT;autovalT_gr__hh__string_hh_: .. das:function:: key_exists(Tab: table|table#; at: string#) : bool Checks whether the temporary string key `at` exists in the table `Tab` and returns `true` if found. :Arguments: * **Tab** : option\ | table\ #> * **at** : string\ # .. _function-builtin_key_exists_table_ls_autokeyT;autovalT_gr_table_ls_autokeyT;autovalT_gr__hh__keyTkeyT_hh_: .. das:function:: key_exists(Tab: table|table#; at: keyT|keyT#) : bool ---- keys ^^^^ .. _function-builtin_keys_table_ls_autokeyT;autovalT_gr___eq__eq_consttable_ls_autokeyT;autovalT_gr__hh___eq__eq_const: .. das:function:: keys(a: table ==const|table# ==const) : iterator Creates an iterator over all keys of the mutable table `a`, allowing enumeration of the table's key set. :Arguments: * **a** : option!\ | table\ #!> .. _function-builtin_keys_table_ls_autokeyT;autovalT_gr___eq__eq_consttable_ls_autokeyT;autovalT_gr__const_hh___eq__eq_const: .. das:function:: keys(a: table ==const|table const# ==const) : iterator ---- length ^^^^^^ .. _function-builtin_length_autoauto_hh_: .. das:function:: length(a: auto|auto#) : int Returns the number of elements currently stored in a table or dynamic array `a`. :Arguments: * **a** : option .. _function-builtin_length_array_ls_anything_gr_: .. das:function:: length(array: array) : int .. _function-builtin_length_table_ls_anything,_anything_gr_: .. das:function:: length(table: table) : int ---- lock ^^^^ .. _function-builtin_lock_table_ls_autokeyT;autovalT_gr_table_ls_autokeyT;autovalT_gr__hh__block_ls_t_c_table_ls_keyT,_valT_gr__hh__c_void_gr_: .. das:function:: lock(Tab: table|table#; blk: block<(t:table#):void>) : auto Locks a constant table for the duration of `blk`, preventing structural modifications while providing read-only access through a temporary reference. :Arguments: * **Tab** : option\ | table\ #> * **blk** : block<(t:table\ #):void> .. _function-builtin_lock_array_ls_autoTT_gr___eq__eq_constarray_ls_autoTT_gr__hh___eq__eq_const_block_ls_var_x_c_array_ls_TT_gr__hh__c_auto_gr_: .. das:function:: lock(a: array ==const|array# ==const; blk: block<(var x:array#):auto>) : auto .. _function-builtin_lock_array_ls_autoTT_gr___eq__eq_constarray_ls_autoTT_gr__const_hh___eq__eq_const_block_ls_x_c_array_ls_TT_gr__hh__c_auto_gr_: .. das:function:: lock(a: array ==const|array const# ==const; blk: block<(x:array#):auto>) : auto ---- .. _function-builtin_lock_forever_table_ls_autokeyT;autovalT_gr_table_ls_autokeyT;autovalT_gr__hh_: .. das:function:: lock_forever(Tab: table|table#) : table# Permanently locks a table, preventing any future insertions, deletions, or structural modifications, and returns a temporary reference to it. :Arguments: * **Tab** : option\ | table\ #> .. _function-builtin_modify__table_ls_autokeyT,_autovalT_gr__keyTkeyT_hh__block_ls_p_c_valT_c_valT_gr_: .. das:function:: modify(Tab: table; at: keyT|keyT#; blk: block<(p:valT):valT>) Looks up `at` in `Tab` and, if found, invokes `blk` with the current value, replacing it with the value returned by the block. :Arguments: * **Tab** : table! * **at** : option * **blk** : block<(p:valT\ &):valT> .. _function-builtin_move_to_local_autoTT_ref__0x392: .. das:function:: move_to_local(a: auto(TT)&) : TT Moves the value referenced by `a` onto the stack as a local copy and returns it, clearing the original; useful for resolving aliasing issues. :Arguments: * **a** : auto(TT)\ & .. _function-builtin_move_to_ref_auto_ref__auto_0x76c: .. das:function:: move_to_ref(a: auto&; b: auto) : auto Moves `b` into the reference `a`; if `b` is a value type rather than a reference, it is copied instead of moved. :Arguments: * **a** : auto\ & * **b** : auto .. _function-builtin_next_iterator_ls_autoTT_gr__TT_ref_: .. das:function:: next(it: iterator; value: TT&) : bool Advances the iterator `it` and stores the next element in `value`, returning true if an element was retrieved or false if the iterator is exhausted or null. :Arguments: * **it** : iterator * **value** : TT\ & .. _function-builtin_nothing_iterator_ls_autoTT_gr_: .. das:function:: nothing(it: iterator) : iterator Produces an empty iterator of the same element type as `it` that yields no elements. :Arguments: * **it** : iterator .. _function-builtin_pop_array_ls_autonumT_gr_: .. das:function:: pop(Arr: array) : auto Removes and discards the last element of `Arr`, reducing its length by one. :Arguments: * **Arr** : array push ^^^^ .. _function-builtin_push_array_ls_autonumT_lb__rb__gr__numT_const_lb__rb___eq__eq_const: .. das:function:: push(Arr: array; varr: numT const[] ==const) : auto Appends a constant fixed-size array element `varr` to the end of `Arr`, an array of fixed-size arrays. :Arguments: * **Arr** : array * **varr** : numT[-1]! .. _function-builtin_push_array_ls_autonumT_gr__numT_lb__rb_: .. das:function:: push(Arr: array; varr: numT[]) : auto .. _function-builtin_push_array_ls_autonumT_lb__rb__gr___numT_lb__rb___eq__eq_const: .. das:function:: push(Arr: array; varr: numT[] ==const) : auto .. _function-builtin_push_array_ls_autonumT_gr__array_ls_numT_gr_: .. das:function:: push(Arr: array; varr: array) : auto .. _function-builtin_push_array_ls_autonumT_gr__numT__eq__eq_const: .. das:function:: push(Arr: array; value: numT ==const) : auto .. _function-builtin_push_array_ls_autonumT_gr___numT__eq__eq_const_int: .. das:function:: push(Arr: array; value: numT ==const; at: int) : auto .. _function-builtin_push_array_ls_autonumT_gr___numT__eq__eq_const: .. das:function:: push(Arr: array; value: numT ==const) : auto .. _function-builtin_push_array_ls_autonumT_gr___array_ls_numT_gr_: .. das:function:: push(Arr: array; varr: array) : auto .. _function-builtin_push_array_ls_autonumT_gr__numT__eq__eq_const_int: .. das:function:: push(Arr: array; value: numT ==const; at: int) : auto ---- push_clone ^^^^^^^^^^ .. _function-builtin_push_clone_autoCT_autoTTautoTT_hh__0x163: .. das:function:: push_clone(A: auto(CT); b: auto(TT)|auto(TT)#) : auto Clones and appends element `b` to the container `A`, using deep copy semantics rather than move or shallow copy. :Arguments: * **A** : auto(CT) * **b** : option .. _function-builtin_push_clone_array_ls_autonumT_lb__rb__gr__numT_lb__rb_: .. das:function:: push_clone(Arr: array; varr: numT[]) : auto .. _function-builtin_push_clone_array_ls_autonumT_gr__numT_const_lb__rb___eq__eq_const: .. das:function:: push_clone(Arr: array; varr: numT const[] ==const) : auto .. _function-builtin_push_clone_array_ls_autonumT_gr__numT__eq__eq_constnumT_hh___eq__eq_const: .. das:function:: push_clone(Arr: array; value: numT ==const|numT# ==const) : auto .. _function-builtin_push_clone_array_ls_autonumT_gr___numT_lb__rb___eq__eq_const: .. das:function:: push_clone(Arr: array; varr: numT[] ==const) : auto .. _function-builtin_push_clone_array_ls_autonumT_gr__numT__eq__eq_constnumT_hh___eq__eq_const_int: .. das:function:: push_clone(Arr: array; value: numT ==const|numT# ==const; at: int) : auto .. _function-builtin_push_clone_array_ls_autonumT_gr__numT__eq__eq_constnumT_const_hh___eq__eq_const_int: .. das:function:: push_clone(Arr: array; value: numT ==const|numT const# ==const; at: int) : auto .. _function-builtin_push_clone_array_ls_autonumT_gr__numT__eq__eq_constnumT_const_hh___eq__eq_const: .. das:function:: push_clone(Arr: array; value: numT ==const|numT const# ==const) : auto .. _function-builtin_push_clone_array_ls_autonumT_lb__rb__gr__numT_const_lb__rb___eq__eq_const: .. das:function:: push_clone(Arr: array; varr: numT const[] ==const) : auto ---- .. _function-builtin_remove_value_array_ls_autoTT_gr_array_ls_autoTT_gr__hh__TT: .. das:function:: remove_value(arr: array|array#; key: TT) : bool Searches `arr` for the first element equal to `key` and removes it, returning true if an element was found and removed or false otherwise. :Arguments: * **arr** : option\ | array\ #> * **key** : TT reserve ^^^^^^^ .. _function-builtin_reserve_table_ls_autokeyT,_auto_gr__int: .. das:function:: reserve(Tab: table; newSize: int) : auto Pre-allocates memory in `Tab` to hold at least `newSize` entries without rehashing, improving performance of subsequent insertions. :Arguments: * **Tab** : table * **newSize** : int .. _function-builtin_reserve_array_ls_autonumT_gr__int: .. das:function:: reserve(Arr: array; newSize: int) : auto ---- .. _function-builtin_resize_array_ls_autonumT_gr__int: .. das:function:: resize(Arr: array; newSize: int) : auto Resizes dynamic array `Arr` to `newSize` elements; new elements beyond the previous length are zero-initialized, and excess elements are removed. :Arguments: * **Arr** : array * **newSize** : int resize_and_init ^^^^^^^^^^^^^^^ .. _function-builtin_resize_and_init_array_ls_autonumT_gr__int_numT: .. das:function:: resize_and_init(Arr: array; newSize: int; initValue: numT) : auto Resizes dynamic array `Arr` to `newSize` elements, initializing any newly added elements with the provided `initValue`. :Arguments: * **Arr** : array * **newSize** : int * **initValue** : numT .. _function-builtin_resize_and_init_array_ls_autonumT_gr__int: .. das:function:: resize_and_init(Arr: array; newSize: int) : auto ---- .. _function-builtin_resize_no_init_array_ls_autonumT_gr__int: .. das:function:: resize_no_init(Arr: array; newSize: int) : auto Resizes dynamic array `Arr` to `newSize` elements without initializing newly added entries, leaving their memory contents undefined. :Arguments: * **Arr** : array * **newSize** : int sort ^^^^ .. _function-builtin_sort_array_ls_autoTT_gr_array_ls_autoTT_gr__hh_: .. das:function:: sort(a: array|array#) : auto Sorts a dynamic array in place in ascending order using the default comparison for its element type. :Arguments: * **a** : option\ | array\ #> .. _function-builtin_sort_autoTT_lb__rb_autoTT_lb__rb__hh__block_ls_x_c_TT;y_c_TT_c_bool_gr_: .. das:function:: sort(a: auto(TT)[]|auto(TT)[]#; cmp: block<(x:TT;y:TT):bool>) : auto .. _function-builtin_sort_autoTT_lb__rb_autoTT_lb__rb__hh_: .. das:function:: sort(a: auto(TT)[]|auto(TT)[]#) : auto .. _function-builtin_sort_array_ls_autoTT_gr_array_ls_autoTT_gr__hh__block_ls_x_c_TT;y_c_TT_c_bool_gr_: .. das:function:: sort(a: array|array#; cmp: block<(x:TT;y:TT):bool>) : auto ---- subarray ^^^^^^^^ .. _function-builtin_subarray_array_ls_autoTT_gr__urange: .. das:function:: subarray(a: array; r: urange) : auto Returns a temporary sub-range of the dynamic array `a` defined by the unsigned range `r`, providing access to elements from `r.x` up to but not including `r.y`. :Arguments: * **a** : array * **r** : urange .. _function-builtin_subarray_autoTT_lb__rb__range_0x735: .. das:function:: subarray(a: auto(TT)[]; r: range) : auto .. _function-builtin_subarray_array_ls_autoTT_gr__range: .. das:function:: subarray(a: array; r: range) : auto .. _function-builtin_subarray_autoTT_lb__rb__urange_0x740: .. das:function:: subarray(a: auto(TT)[]; r: urange) : auto .. _function-builtin_subarray__array_ls_autoTT_gr__range: .. das:function:: subarray(a: array; r: range) : auto ---- to_array ^^^^^^^^ .. _function-builtin_to_array_autoTT_lb__rb__0x571: .. das:function:: to_array(a: auto(TT)[]) : array Converts a fixed-size array `a` into a new dynamic array by cloning each element. :Arguments: * **a** : auto(TT)[-1] .. _function-builtin_to_array_iterator_ls_autoTT_gr_: .. das:function:: to_array(it: iterator) : array ---- to_array_move ^^^^^^^^^^^^^ .. _function-builtin_to_array_move__autoTT__eq__eq_const_0x59f: .. das:function:: to_array_move(a: auto(TT) ==const) : array Converts a mutable container `a` into a new dynamic array, moving elements when possible instead of cloning. :Arguments: * **a** : auto(TT)! .. _function-builtin_to_array_move_autoTT_lb__rb__0x57a: .. das:function:: to_array_move(a: auto(TT)[]) : array .. _function-builtin_to_array_move_autoTT__eq__eq_const_0x58e: .. das:function:: to_array_move(a: auto(TT) ==const) : array ---- to_table ^^^^^^^^ .. _function-builtin_to_table_tuple_ls_autokeyT;autovalT_gr__lb__rb_: .. das:function:: to_table(a: tuple[]) : table Converts a fixed-size array of key-value tuples `a` into a `table` by cloning each key and value. :Arguments: * **a** : tuple[-1] .. _function-builtin_to_table_autokeyT_lb__rb__0x5b8: .. das:function:: to_table(a: auto(keyT)[]) : table ---- to_table_move ^^^^^^^^^^^^^ .. _function-builtin_to_table_move_tuple_ls_autokeyT;autovalT_gr__lb__rb_: .. das:function:: to_table_move(a: tuple[]) : table Converts a mutable fixed-size array of key-value tuples `a` into a `table`, moving elements when possible. :Arguments: * **a** : tuple[-1] .. _function-builtin_to_table_move_array_ls_tuple_ls_autokeyT;autovalT_gr__gr_: .. das:function:: to_table_move(a: array>) : table .. _function-builtin_to_table_move_tuple_ls_autokeyT;autovalT_gr_: .. das:function:: to_table_move(a: tuple) : table .. _function-builtin_to_table_move_array_ls_autokeyT_gr_: .. das:function:: to_table_move(a: array) : table .. _function-builtin_to_table_move_autokeyT_lb__rb__0x5c0: .. das:function:: to_table_move(a: auto(keyT)[]) : table .. _function-builtin_to_table_move_autokeyT_0x5d0: .. das:function:: to_table_move(a: auto(keyT)) : table ---- values ^^^^^^ .. _function-builtin_values_table_ls_autokeyT;autovalT_lb__rb__gr___eq__eq_consttable_ls_autokeyT;autovalT_lb__rb__gr__hh___eq__eq_const: .. das:function:: values(a: table ==const|table# ==const) : iterator Returns a mutable iterator over all fixed-size array values in a mutable `table`, yielding each array by reference. :Arguments: * **a** : option!\ | table\ #!> .. _function-builtin_values_table_ls_autokeyT;autovalT_lb__rb__gr___eq__eq_consttable_ls_autokeyT;autovalT_lb__rb__gr__const_hh___eq__eq_const: .. das:function:: values(a: table ==const|table const# ==const) : iterator .. _function-builtin_values_table_ls_autokeyT;autovalT_gr___eq__eq_consttable_ls_autokeyT;autovalT_gr__const_hh___eq__eq_const: .. das:function:: values(a: table ==const|table const# ==const) : iterator .. _function-builtin_values_table_ls_autokeyT;void_gr___eq__eq_consttable_ls_autokeyT;void_gr__const_hh___eq__eq_const: .. das:function:: values(a: table ==const|table const# ==const) : auto .. _function-builtin_values_table_ls_autokeyT;void_gr___eq__eq_consttable_ls_autokeyT;void_gr__hh___eq__eq_const: .. das:function:: values(a: table ==const|table# ==const) : auto .. _function-builtin_values_table_ls_autokeyT;autovalT_gr___eq__eq_consttable_ls_autokeyT;autovalT_gr__hh___eq__eq_const: .. das:function:: values(a: table ==const|table# ==const) : iterator ++++++++++++++++++++++++ das::string manipulation ++++++++++++++++++++++++ * :ref:`peek (src: das_string; block: block\<(string#):void\>) ` .. _function-builtin_peek_das_string_block_ls_string_hh__c_void_gr_: .. das:function:: peek(src: das_string; block: block<(string#):void>) Provides zero-copy read access to the contents of a `das_string` by invoking `block` with a temporary string reference, avoiding allocation. :Arguments: * **src** : :ref:`das_string ` implicit * **block** : block<(string\ #):void> implicit ++++++++++++++ Heap reporting ++++++++++++++ * :ref:`heap_allocation_count () : uint64 ` * :ref:`heap_allocation_stats () : urange64 ` * :ref:`heap_bytes_allocated () : uint64 ` * :ref:`heap_collect (string_heap: bool = true; validate: bool = false) ` * :ref:`heap_depth () : int ` * :ref:`heap_report () ` * :ref:`memory_report (errorsOnly: bool) ` * :ref:`string_heap_allocation_count () : uint64 ` * :ref:`string_heap_allocation_stats () : urange64 ` * :ref:`string_heap_bytes_allocated () : uint64 ` * :ref:`string_heap_depth () : int ` * :ref:`string_heap_report () ` .. _function-builtin_heap_allocation_count: .. das:function:: heap_allocation_count() : uint64 Returns the total number of heap allocations performed by the current context since it was created. .. _function-builtin_heap_allocation_stats: .. das:function:: heap_allocation_stats() : urange64 Returns heap allocation statistics as a `urange64`, where the `x` component is total bytes allocated and the `y` component is total bytes freed. .. _function-builtin_heap_bytes_allocated: .. das:function:: heap_bytes_allocated() : uint64 Returns the number of bytes currently in use on the heap (allocated minus freed), not counting reserved but unused memory. .. _function-builtin_heap_collect_bool_bool: .. das:function:: heap_collect(string_heap: bool = true; validate: bool = false) .. warning:: This is unsafe operation. Triggers garbage collection on the context heap; when `string_heap` is `true` the string heap is also collected, and when `validate` is `true` additional validation checks are performed. :Arguments: * **string_heap** : bool * **validate** : bool .. _function-builtin_heap_depth: .. das:function:: heap_depth() : int Returns the number of generations (depth of the allocation chain) in the context's regular heap. .. _function-builtin_heap_report: .. das:function:: heap_report() Prints a diagnostic report of current heap usage and allocation statistics to the output log. .. _function-builtin_memory_report_bool: .. das:function:: memory_report(errorsOnly: bool) Prints a report of memory allocations for the current context; when `errorsOnly` is true, only GC-related errors are included. :Arguments: * **errorsOnly** : bool .. _function-builtin_string_heap_allocation_count: .. das:function:: string_heap_allocation_count() : uint64 Returns the total number of individual string allocations performed on the current context's string heap. .. _function-builtin_string_heap_allocation_stats: .. das:function:: string_heap_allocation_stats() : urange64 Returns string heap allocation statistics as a `urange64` where `x` is total bytes allocated and `y` is total bytes deleted. .. _function-builtin_string_heap_bytes_allocated: .. das:function:: string_heap_bytes_allocated() : uint64 Returns the total number of bytes currently allocated in the current context's string heap. .. _function-builtin_string_heap_depth: .. das:function:: string_heap_depth() : int Returns the number of generational layers (depth) in the current context's string heap. .. _function-builtin_string_heap_report: .. das:function:: string_heap_report() Prints a detailed report of string heap usage, including allocation counts and byte statistics, to the log output. ++++++++++++++++++ GC0 infrastructure ++++++++++++++++++ * :ref:`gc0_reset () ` * :ref:`gc0_restore_ptr (name: string) : void? ` * :ref:`gc0_restore_smart_ptr (name: string) : smart_ptr\ ` * :ref:`gc0_save_ptr (name: string; data: void?) ` * :ref:`gc0_save_smart_ptr (name: string; data: smart_ptr\) ` .. _function-builtin_gc0_reset: .. das:function:: gc0_reset() Clears the entire gc0 storage, invalidating all previously saved pointers and smart pointers stored within it. .. _function-builtin_gc0_restore_ptr_string: .. das:function:: gc0_restore_ptr(name: string) : void? Retrieves a raw pointer previously saved in gc0 storage under the specified `name`, returning `null` if not found. :Arguments: * **name** : string implicit .. _function-builtin_gc0_restore_smart_ptr_string: .. das:function:: gc0_restore_smart_ptr(name: string) : smart_ptr Retrieves a `smart_ptr` previously saved in gc0 storage under the specified `name`. :Arguments: * **name** : string implicit .. _function-builtin_gc0_save_ptr_string_void_q_: .. das:function:: gc0_save_ptr(name: string; data: void?) Stores a raw pointer `data` into gc0 storage under the specified `name`, allowing it to be retrieved later with `gc0_restore_ptr`. :Arguments: * **name** : string implicit * **data** : void? implicit .. _function-builtin_gc0_save_smart_ptr_string_smart_ptr_ls_void_gr_: .. das:function:: gc0_save_smart_ptr(name: string; data: smart_ptr) Stores a `smart_ptr` `data` into gc0 storage under the specified `name`, allowing it to be retrieved later with `gc0_restore_smart_ptr`. :Arguments: * **name** : string implicit * **data** : smart_ptr implicit ++++++++++++++++++++++++ Smart ptr infrastructure ++++++++++++++++++++++++ * :ref:`add_ptr_ref (src: auto(TT)?) : smart_ptr\ ` * :ref:`add_ptr_ref (src: smart_ptr\) : smart_ptr\ ` * :ref:`get_const_ptr (src: smart_ptr\) : TT? ` * :ref:`get_ptr (var src: smart_ptr\ ==const) : TT? ` * :ref:`get_ptr (src: smart_ptr\ ==const) : TT? ` * :ref:`move (dest: smart_ptr\&; src: void?) ` * :ref:`move (dest: smart_ptr\&; src: smart_ptr\&) ` * :ref:`move_new (dest: smart_ptr\&; src: smart_ptr\) ` * :ref:`smart_ptr_clone (dest: smart_ptr\&; src: void?) ` * :ref:`smart_ptr_clone (dest: smart_ptr\&; src: smart_ptr\) ` * :ref:`smart_ptr_is_valid (dest: smart_ptr\) : bool ` * :ref:`smart_ptr_use_count (ptr: smart_ptr\) : uint ` add_ptr_ref ^^^^^^^^^^^ .. _function-builtin_add_ptr_ref_autoTT_q_: .. das:function:: add_ptr_ref(src: auto(TT)?) : smart_ptr Wraps a raw pointer ``src`` of type ``TT?`` into a ``smart_ptr`` by incrementing the reference count. Commonly used to bridge AST node fields (which are raw pointers like ``Structure?``, ``Enumeration?``) to API functions that expect ``smart_ptr``. The overload accepting ``smart_ptr`` adds an additional reference to an existing smart pointer, returning a new ``smart_ptr`` that shares ownership. :Arguments: * **src** : auto(TT)? .. _function-builtin_add_ptr_ref_smart_ptr_ls_autoTT_gr_: .. das:function:: add_ptr_ref(src: smart_ptr) : smart_ptr ---- .. _function-builtin_get_const_ptr_smart_ptr_ls_autoTT_gr_: .. das:function:: get_const_ptr(src: smart_ptr) : TT? Extracts a constant raw pointer of type `TT?` from the given `smart_ptr`, without affecting reference counting. :Arguments: * **src** : smart_ptr get_ptr ^^^^^^^ .. _function-builtin_get_ptr__smart_ptr_ls_autoTT_gr___eq__eq_const: .. das:function:: get_ptr(src: smart_ptr ==const) : TT? Extracts a mutable raw pointer of type `TT?` from the given mutable `smart_ptr`, without affecting reference counting. :Arguments: * **src** : smart_ptr! .. _function-builtin_get_ptr_smart_ptr_ls_autoTT_gr___eq__eq_const: .. das:function:: get_ptr(src: smart_ptr ==const) : TT? ---- move ^^^^ .. _function-builtin_move_smart_ptr_ls_void_gr__ref__void_q_: .. das:function:: move(dest: smart_ptr&; src: void?) Moves a raw pointer `src` into the smart pointer `dest`, nullifying the previous contents of `dest` and transferring ownership of `src`. :Arguments: * **dest** : smart_ptr\ & implicit * **src** : void? implicit .. _function-builtin_move_smart_ptr_ls_void_gr__ref__smart_ptr_ls_void_gr__ref_: .. das:function:: move(dest: smart_ptr&; src: smart_ptr&) ---- .. _function-builtin_move_new_smart_ptr_ls_void_gr__ref__smart_ptr_ls_void_gr_: .. das:function:: move_new(dest: smart_ptr&; src: smart_ptr) Moves a newly constructed smart pointer value `src` into `dest`, used to initialize a `smart_ptr` from a `new` expression. :Arguments: * **dest** : smart_ptr\ & implicit * **src** : smart_ptr implicit smart_ptr_clone ^^^^^^^^^^^^^^^ .. _function-builtin_smart_ptr_clone_smart_ptr_ls_void_gr__ref__void_q_: .. das:function:: smart_ptr_clone(dest: smart_ptr&; src: void?) Clones a raw pointer `src` into smart pointer `dest`, incrementing the internal reference count to share ownership. :Arguments: * **dest** : smart_ptr\ & implicit * **src** : void? implicit .. _function-builtin_smart_ptr_clone_smart_ptr_ls_void_gr__ref__smart_ptr_ls_void_gr_: .. das:function:: smart_ptr_clone(dest: smart_ptr&; src: smart_ptr) ---- .. _function-builtin_smart_ptr_is_valid_smart_ptr_ls_void_gr_: .. das:function:: smart_ptr_is_valid(dest: smart_ptr) : bool Checks whether the smart pointer `dest` holds a non-null reference to valid data, returning true if it does. :Arguments: * **dest** : smart_ptr implicit .. _function-builtin_smart_ptr_use_count_smart_ptr_ls_void_gr_: .. das:function:: smart_ptr_use_count(ptr: smart_ptr) : uint Returns the current reference count of the object managed by `ptr`, indicating how many smart pointers share ownership. :Arguments: * **ptr** : smart_ptr implicit ++++++++++++++++++++ Macro infrastructure ++++++++++++++++++++ * :ref:`is_compiling () : bool ` * :ref:`is_compiling_macros () : bool ` * :ref:`is_compiling_macros_in_module (name: string) : bool ` * :ref:`is_folding () : bool ` * :ref:`is_in_completion () : bool ` * :ref:`is_in_lint_check () : bool ` * :ref:`is_reporting_compilation_errors () : bool ` .. _function-builtin_is_compiling: .. das:function:: is_compiling() : bool Returns `true` if the current context is in the process of being compiled, allowing compile-time logic to distinguish from runtime execution. .. _function-builtin_is_compiling_macros: .. das:function:: is_compiling_macros() : bool Returns `true` if the current context is being compiled and the compiler is currently executing the macro pass. .. _function-builtin_is_compiling_macros_in_module_string: .. das:function:: is_compiling_macros_in_module(name: string) : bool Returns `true` if the current context is being compiled during the macro pass and the compiler is processing the module specified by `name`. :Arguments: * **name** : string implicit .. _function-builtin_is_folding: .. das:function:: is_folding() : bool Returns `true` if the compiler is currently performing its constant folding optimization pass. .. _function-builtin_is_in_completion: .. das:function:: is_in_completion() : bool Returns `true` if the compiler is running in completion mode, generating lexical information for a text editor's code-completion system. .. _function-builtin_is_in_lint_check: .. das:function:: is_in_lint_check() : bool Returns true if the program is being compiled in lint-check mode (i.e. `CodeOfPolicies.lint_check` is set). Modules can use this to skip side effects like debug agent installation during lint-only compilation. .. _function-builtin_is_reporting_compilation_errors: .. das:function:: is_reporting_compilation_errors() : bool Returns `true` if the context failed to compile and the inference pass is currently reporting compilation errors. ++++++++ Profiler ++++++++ * :ref:`collect_profile_info () : string ` * :ref:`dump_profile_info () ` * :ref:`profile (count: int; category: string; block: block\<():void\>) : float ` * :ref:`reset_profiler () ` .. _function-builtin_collect_profile_info: .. das:function:: collect_profile_info() : string Collects profiling information gathered by the built-in line profiler and returns it as a formatted string containing execution counts and timing data. .. _function-builtin_dump_profile_info: .. das:function:: dump_profile_info() Prints the execution counts and timing data for all lines collected by the built-in line profiler to the standard output. .. _function-builtin_profile_int_string_block_ls__c_void_gr_: .. das:function:: profile(count: int; category: string; block: block<():void>) : float Executes `block` a total of `count` times under the given `category` label, prints the timing, and returns the minimum elapsed time in seconds across all iterations. :Arguments: * **count** : int * **category** : string implicit * **block** : block implicit .. _function-builtin_reset_profiler: .. das:function:: reset_profiler() Resets all counters and accumulated data in the built-in profiler to zero. +++++++++++++++++++++ System infrastructure +++++++++++++++++++++ * :ref:`aot_enabled () : bool ` * :ref:`breakpoint () ` * :ref:`error (text: string) ` * :ref:`eval_main_loop (block: block\<():void\>) ` * :ref:`feint (text: string) ` * :ref:`get_das_root () : string ` * :ref:`get_das_version () : string ` * :ref:`is_in_aot () : bool ` * :ref:`is_intern_strings () : bool ` * :ref:`panic (text: string) ` * :ref:`print (text: string) ` * :ref:`shared_module_extension () : string ` * :ref:`sprint (value: any; flags: print_flags) : string ` * :ref:`sprint_json (value: any; humanReadable: bool) : string ` * :ref:`sscan_json (json: string; value: any) : bool ` * :ref:`stackwalk (args: bool = true; vars: bool = true) ` * :ref:`terminate () ` * :ref:`to_compiler_log (text: string) ` * :ref:`to_log (level: int; text: string) ` .. _function-builtin_aot_enabled: .. das:function:: aot_enabled() : bool Checks whether ahead-of-time (AOT) compilation is enabled for the current program and returns true if it is. .. _function-builtin_breakpoint: .. das:function:: breakpoint() Triggers a debugger breakpoint by calling `os_debugbreakpoint`, which is a link-time dependency expected to be provided by the host application or debugger tool. .. _function-builtin_error_string: .. das:function:: error(text: string) Outputs the string `text` to the context's error stream, similar to `print` but directed to the error output channel. :Arguments: * **text** : string implicit .. _function-builtin_eval_main_loop_block_ls__c_void_gr_: .. das:function:: eval_main_loop(block: block<():void>) Executes the application main loop by repeatedly invoking `block` until it returns `false`; on Emscripten targets, uses the platform-specific main loop mechanism instead. :Arguments: * **block** : block implicit .. _function-builtin_feint_string: .. das:function:: feint(text: string) No-op replacement for `print`. Has the same signature and side-effect annotations as `print`, but intentionally does nothing. Use `feint` in tests where print-like behavior is needed to prevent the call from being optimized out, but no actual output is desired. :Arguments: * **text** : string implicit .. _function-builtin_get_das_root: .. das:function:: get_das_root() : string Returns the file-system path to the daslang root directory, where `daslib` and other standard libraries are located. .. _function-builtin_get_das_version: .. das:function:: get_das_version() : string Returns the daslang SDK version as a string in "major.minor.patch" format (e.g. "0.6.0"). .. _function-builtin_is_in_aot: .. das:function:: is_in_aot() : bool Returns `true` if the compiler is currently generating ahead-of-time (AOT) compiled code. .. _function-builtin_is_intern_strings: .. das:function:: is_intern_strings() : bool Returns `true` if string interning is enabled in the current context, meaning identical strings share the same memory. .. _function-builtin_panic_string: .. das:function:: panic(text: string) will cause panic. The program will be terminated if there is no recover. Panic is not an error handling mechanism and can not be used as such. It is indeed panic, fatal error. It is not supposed that program can completely correctly recover from panic, recover construction is provided so program can try to correctly shut-down or report fatal error. If there is no recover within the script, it will be called in calling eval (in C++ callee code). :Arguments: * **text** : string implicit .. _function-builtin_print_string: .. das:function:: print(text: string) Outputs `text` to the current context's log, typically printing to standard output. :Arguments: * **text** : string implicit .. _function-builtin_shared_module_extension: .. das:function:: shared_module_extension() : string Returns the file extension used for shared (dynamic) modules on the current platform. .. _function-builtin_sprint_any_print_flags: .. das:function:: sprint(value: any; flags: print_flags) : string Converts `value` to its string representation using the specified `flags` to control formatting, and returns the result as a string. :Arguments: * **value** : any * **flags** : :ref:`print_flags ` .. _function-builtin_sprint_json_any_bool: .. das:function:: sprint_json(value: any; humanReadable: bool) : string Serializes `value` directly to a JSON string, bypassing intermediate representation for speed; set `humanReadable` to true for indented output. :Arguments: * **value** : any * **humanReadable** : bool .. _function-builtin_sscan_json_string_any: .. das:function:: sscan_json(json: string; value: any) : bool Parses a JSON string directly into `value` using RTTI type information — no intermediate ``JsonValue?`` representation. Returns true on success. Supports structs, pointers, arrays, tables, tuples, variants, enums, bitfields, vector types, and all scalar types. Handles ``@rename`` field annotations. Throws an error for handled types. :Arguments: * **json** : string * **value** : any .. _function-builtin_stackwalk_bool_bool: .. das:function:: stackwalk(args: bool = true; vars: bool = true) Prints the current call stack to the log; set `args` to include function arguments and `vars` to include local variable values in the output. :Arguments: * **args** : bool * **vars** : bool .. _function-builtin_terminate: .. das:function:: terminate() Immediately terminates execution of the current daslang context. .. _function-builtin_to_compiler_log_string: .. das:function:: to_compiler_log(text: string) Outputs `text` to the compiler's log stream, typically used from within macro code during compilation. :Arguments: * **text** : string implicit .. _function-builtin_to_log_int_string: .. das:function:: to_log(level: int; text: string) Outputs `text` to the logging infrastructure at the specified `level` (e.g. LOG_INFO, LOG_ERROR), rather than to standard output. :Arguments: * **level** : int * **text** : string implicit +++++++++++++++++++ Memory manipulation +++++++++++++++++++ * :ref:`hash (value: int8) : uint64 ` * :ref:`hash (data: any) : uint64 ` * :ref:`hash (data: string) : uint64 ` * :ref:`hash (value: int) : uint64 ` * :ref:`hash (value: int16) : uint64 ` * :ref:`hash (value: uint8) : uint64 ` * :ref:`hash (value: uint16) : uint64 ` * :ref:`hash (value: double) : uint64 ` * :ref:`hash (value: int64) : uint64 ` * :ref:`hash (value: uint) : uint64 ` * :ref:`hash (value: uint64) : uint64 ` * :ref:`hash (value: void?) : uint64 ` * :ref:`hash (value: float) : uint64 ` * :ref:`hash (value: das_string) : uint64 ` * :ref:`intptr (p: smart_ptr\) : uint64 ` * :ref:`intptr (p: void?) : uint64 ` * :ref:`lock_data (a: array\ ==const|array\ const# ==const; blk: block\<(p:TT const?#;s:int):auto\>) : auto ` * :ref:`lock_data (var a: array\ ==const|array\# ==const; blk: block\<(var p:TT?#;s:int):auto\>) : auto ` * :ref:`map_to_array (data: void?; len: int; blk: block\<(var arg:array\#):auto\>) : auto ` * :ref:`map_to_ro_array (data: void?; len: int; blk: block\<(arg:array\#):auto\>) : auto ` * :ref:`memcmp (left: void?; right: void?; size: int) : int ` * :ref:`memcpy (left: void?; right: void?; size: int) ` * :ref:`set_variant_index (variant: variant\<\>; index: int) ` * :ref:`variant_index (arg0: variant\<\>) : int ` hash ^^^^ .. _function-builtin_hash_int8: .. das:function:: hash(value: int8) : uint64 Computes a 64-bit FNV-1a hash of the given `int8` value and returns it as `uint64`. :Arguments: * **value** : int8 .. _function-builtin_hash_any: .. das:function:: hash(data: any) : uint64 .. _function-builtin_hash_string: .. das:function:: hash(data: string) : uint64 .. _function-builtin_hash_int: .. das:function:: hash(value: int) : uint64 .. _function-builtin_hash_int16: .. das:function:: hash(value: int16) : uint64 .. _function-builtin_hash_uint8: .. das:function:: hash(value: uint8) : uint64 .. _function-builtin_hash_uint16: .. das:function:: hash(value: uint16) : uint64 .. _function-builtin_hash_double: .. das:function:: hash(value: double) : uint64 .. _function-builtin_hash_int64: .. das:function:: hash(value: int64) : uint64 .. _function-builtin_hash_uint: .. das:function:: hash(value: uint) : uint64 .. _function-builtin_hash_uint64: .. das:function:: hash(value: uint64) : uint64 .. _function-builtin_hash_void_q_: .. das:function:: hash(value: void?) : uint64 .. _function-builtin_hash_float: .. das:function:: hash(value: float) : uint64 .. _function-builtin_hash_das_string: .. das:function:: hash(value: das_string) : uint64 ---- intptr ^^^^^^ .. _function-builtin_intptr_smart_ptr_ls_auto_gr_: .. das:function:: intptr(p: smart_ptr) : uint64 Converts a `smart_ptr` `p` to its `uint64` integer representation, useful for pointer arithmetic or serialization. :Arguments: * **p** : smart_ptr .. _function-builtin_intptr_void_q_: .. das:function:: intptr(p: void?) : uint64 ---- lock_data ^^^^^^^^^ .. _function-builtin_lock_data_array_ls_autoTT_gr___eq__eq_constarray_ls_autoTT_gr__const_hh___eq__eq_const_block_ls_p_c_TT_const_q__hh_;s_c_int_c_auto_gr_: .. das:function:: lock_data(a: array ==const|array const# ==const; blk: block<(p:TT const?#;s:int):auto>) : auto Locks a constant array and invokes `blk` with a read-only pointer `p` to the array's contiguous data and its size `s`, allowing direct memory-level read access. :Arguments: * **a** : option!\ | array\ #!> * **blk** : block<(p:TT?\ #;s:int):auto> .. _function-builtin_lock_data_array_ls_autoTT_gr___eq__eq_constarray_ls_autoTT_gr__hh___eq__eq_const_block_ls_var_p_c_TT_q__hh_;s_c_int_c_auto_gr_: .. das:function:: lock_data(a: array ==const|array# ==const; blk: block<(var p:TT?#;s:int):auto>) : auto ---- .. _function-builtin_map_to_array_void_q__int_block_ls_var_arg_c_array_ls_autoTT_gr__hh__c_auto_gr_: .. das:function:: map_to_array(data: void?; len: int; blk: block<(var arg:array#):auto>) : auto .. warning:: This is unsafe operation. Constructs a temporary mutable array of type `TT` over raw memory at `data` with `len` elements, and passes it to `blk` without copying the underlying data. :Arguments: * **data** : void? * **len** : int * **blk** : block<(arg:array\ #):auto> .. _function-builtin_map_to_ro_array_void_q__int_block_ls_arg_c_array_ls_autoTT_gr__hh__c_auto_gr_: .. das:function:: map_to_ro_array(data: void?; len: int; blk: block<(arg:array#):auto>) : auto .. warning:: This is unsafe operation. Constructs a temporary read-only array of type `TT` over raw memory at `data` with `len` elements, and passes it to `blk` without copying the underlying data. :Arguments: * **data** : void? * **len** : int * **blk** : block<(arg:array\ #):auto> .. _function-builtin_memcmp_void_q__void_q__int: .. das:function:: memcmp(left: void?; right: void?; size: int) : int .. warning:: This is unsafe operation. Compares `size` bytes of memory at `left` and `right`, returning -1 if `left` is less, 1 if `left` is greater, or 0 if both regions are identical. :Arguments: * **left** : void? implicit * **right** : void? implicit * **size** : int .. _function-builtin_memcpy_void_q__void_q__int: .. das:function:: memcpy(left: void?; right: void?; size: int) .. warning:: This is unsafe operation. Copies `size` bytes of memory from the address pointed to by `right` into the address pointed to by `left`. :Arguments: * **left** : void? implicit * **right** : void? implicit * **size** : int .. _function-builtin_set_variant_index_variant_ls__gr__int: .. das:function:: set_variant_index(variant: variant<>; index: int) .. warning:: This is unsafe operation. Overwrites the internal type discriminator of `variant` to `index`, changing which alternative the variant is considered to hold. :Arguments: * **variant** : variant<> implicit * **index** : int .. _function-builtin_variant_index_variant_ls__gr_: .. das:function:: variant_index(arg0: variant<>) : int Returns the zero-based index indicating which alternative the variant currently holds. :Arguments: * **arg0** : variant<> implicit +++++++++++++++++ Binary serializer +++++++++++++++++ * :ref:`binary_load (var obj: auto; data: array\) : auto ` * :ref:`binary_save (obj: auto; subexpr: block\<(data:array\#):void\>) : auto ` .. _function-builtin_binary_load_auto_array_ls_uint8_gr__0x385: .. das:function:: binary_load(obj: auto; data: array) : auto Deserializes `obj` from the binary representation stored in `data` (an array of uint8 bytes). Obsolete — use `daslib/archive` instead. :Arguments: * **obj** : auto * **data** : array implicit .. _function-builtin_binary_save_auto_block_ls_data_c_array_ls_uint8_gr__hh__c_void_gr__0x380: .. das:function:: binary_save(obj: auto; subexpr: block<(data:array#):void>) : auto Serializes `obj` into a binary representation and passes the resulting uint8 byte array to the block `subexpr`. Obsolete — use `daslib/archive` instead. :Arguments: * **obj** : auto * **subexpr** : block<(data:array\ #):void> +++++++++++++++++++++ Path and command line +++++++++++++++++++++ * :ref:`get_command_line_arguments () : array\ ` * :ref:`with_argv (new_arguments: array\; block: block\<():void\>) ` .. _function-builtin_get_command_line_arguments: .. das:function:: get_command_line_arguments() : array Returns an array of strings containing the command-line arguments passed to the program. .. _function-builtin_with_argv_array_ls_anything_gr__block_ls__c_void_gr_: .. das:function:: with_argv(new_arguments: array; block: block<():void>) Sets ``argc``, ``argv`` to first argument, for the ``body`` block. :Arguments: * **new_arguments** : array implicit * **block** : block implicit +++++++++++++ Time and date +++++++++++++ * :ref:`get_clock () : clock ` * :ref:`get_time_nsec (ref: int64) : int64 ` * :ref:`get_time_usec (ref: int64) : int ` * :ref:`mktime (year: int; month: int; mday: int; hour: int; min: int; sec: int) : clock ` * :ref:`ref_time_ticks () : int64 ` .. _function-builtin_get_clock: .. das:function:: get_clock() : clock Returns the current calendar time as a `clock` value representing the number of seconds since 00:00 UTC, January 1, 1970 (the Unix epoch). .. _function-builtin_get_time_nsec_int64: .. das:function:: get_time_nsec(ref: int64) : int64 Computes the elapsed time in nanoseconds since the reference point `ref`, which is typically obtained from `ref_time_ticks`. :Arguments: * **ref** : int64 .. _function-builtin_get_time_usec_int64: .. das:function:: get_time_usec(ref: int64) : int Computes the elapsed time in microseconds since the reference point `ref`, which is typically obtained from `ref_time_ticks`. :Arguments: * **ref** : int64 .. _function-builtin_mktime_int_int_int_int_int_int: .. das:function:: mktime(year: int; month: int; mday: int; hour: int; min: int; sec: int) : clock Converts the calendar date and time specified by `year`, `month`, `mday`, `hour`, `min`, and `sec` into a `clock` value representing time since epoch. :Arguments: * **year** : int * **month** : int * **mday** : int * **hour** : int * **min** : int * **sec** : int .. _function-builtin_ref_time_ticks: .. das:function:: ref_time_ticks() : int64 Captures the current high-resolution time in ticks, suitable for measuring elapsed intervals with `get_time_usec`. ++++++++++++++++ Platform queries ++++++++++++++++ * :ref:`das_is_dll_build () : bool ` * :ref:`get_architecture_name () : string ` * :ref:`get_context_share_counter () : uint64 ` * :ref:`get_platform_name () : string ` .. _function-builtin_das_is_dll_build: .. das:function:: das_is_dll_build() : bool Checks whether the current build is configured as a DLL (dynamic library) build, which determines if daslib symbols are available for the JIT compiler. .. _function-builtin_get_architecture_name: .. das:function:: get_architecture_name() : string Returns the name of the CPU architecture the program is running on, such as `"x86_64"`, `"x86"`, `"arm64"`, `"arm"`, `"wasm32"`, or `"unknown"`. .. _function-builtin_get_context_share_counter: .. das:function:: get_context_share_counter() : uint64 Returns the use-count of the shared context, which is incremented each time a thread accesses it; useful for tracking concurrent context usage. .. _function-builtin_get_platform_name: .. das:function:: get_platform_name() : string Returns the name of the operating system the program is running on, such as `"windows"`, `"linux"`, `"darwin"`, `"emscripten"`, or `"unknown"`. +++++++++++++++++ String formatting +++++++++++++++++ * :ref:`fmt (format: string; value: uint8) : string ` * :ref:`fmt (format: string; value: int8) : string ` * :ref:`fmt (format: string; value: uint16) : string ` * :ref:`fmt (format: string; value: int16) : string ` * :ref:`fmt (format: string; value: int64) : string ` * :ref:`fmt (format: string; value: uint) : string ` * :ref:`fmt (format: string; value: uint64) : string ` * :ref:`fmt (format: string; value: int) : string ` * :ref:`fmt (format: string; value: double) : string ` * :ref:`fmt (format: string; value: float) : string ` fmt ^^^ .. _function-builtin_fmt_string_uint8: .. das:function:: fmt(format: string; value: uint8) : string Formats a `uint8` value as a string using the given `format` specifier (following libfmt / C++20 `std::format` syntax). :Arguments: * **format** : string implicit * **value** : uint8 .. _function-builtin_fmt_string_int8: .. das:function:: fmt(format: string; value: int8) : string .. _function-builtin_fmt_string_uint16: .. das:function:: fmt(format: string; value: uint16) : string .. _function-builtin_fmt_string_int16: .. das:function:: fmt(format: string; value: int16) : string .. _function-builtin_fmt_string_int64: .. das:function:: fmt(format: string; value: int64) : string .. _function-builtin_fmt_string_uint: .. das:function:: fmt(format: string; value: uint) : string .. _function-builtin_fmt_string_uint64: .. das:function:: fmt(format: string; value: uint64) : string .. _function-builtin_fmt_string_int: .. das:function:: fmt(format: string; value: int) : string .. _function-builtin_fmt_string_double: .. das:function:: fmt(format: string; value: double) : string .. _function-builtin_fmt_string_float: .. das:function:: fmt(format: string; value: float) : string ++++++++++++++++++++ Argument consumption ++++++++++++++++++++ * :ref:`consume_argument (var a: auto(TT)&) : TT& ` .. _function-builtin_consume_argument_autoTT_ref__0x7a0: .. das:function:: consume_argument(a: auto(TT)&) : TT& Marks argument `a` as consumed, signaling to the compiler that it will not be used after this call, which enables move optimizations and avoids unnecessary clones. Equivalent to the `<-arg` syntax. :Arguments: * **a** : auto(TT)\ & +++++++++++++ Lock checking +++++++++++++ * :ref:`lock_count (array: array\) : int ` .. _function-builtin_lock_count_array_ls_anything_gr_: .. das:function:: lock_count(array: array) : int Returns the current internal lock count for the given `array`, indicating how many active locks prevent it from being resized. :Arguments: * **array** : array implicit ++++++++++++++ Bit operations ++++++++++++++ * :ref:`__bit_set (value: bitfield&; mask: bitfield; on: bool) ` * :ref:`__bit_set (value: bitfield8:uint8\<\>&; mask: bitfield8:uint8\<\>; on: bool) ` * :ref:`__bit_set (value: bitfield64:uint64\<\>&; mask: bitfield64:uint64\<\>; on: bool) ` * :ref:`__bit_set (value: bitfield16:uint16\<\>&; mask: bitfield16:uint16\<\>; on: bool) ` * :ref:`clz (bits: uint64) : uint64 ` * :ref:`clz (bits: uint) : uint ` * :ref:`ctz (bits: uint64) : uint64 ` * :ref:`ctz (bits: uint) : uint ` * :ref:`mul128 (a: uint64; b: uint64) : urange64 ` * :ref:`popcnt (bits: uint64) : uint64 ` * :ref:`popcnt (bits: uint) : uint ` __bit_set ^^^^^^^^^ .. _function-builtin___bit_set_bitfield_ref__bitfield_bool: .. das:function:: __bit_set(value: bitfield&; mask: bitfield; on: bool) Sets or clears the bits specified by `mask` in the 16-bit bitfield `value`, turning them on if `on` is true or off if `on` is false. :Arguments: * **value** : bitfield<>\ & implicit * **mask** : bitfield<> * **on** : bool .. _function-builtin___bit_set_bitfield8_c_uint8_ls__gr__ref__bitfield8_c_uint8_ls__gr__bool: .. das:function:: __bit_set(value: bitfield8:uint8<>&; mask: bitfield8:uint8<>; on: bool) .. _function-builtin___bit_set_bitfield64_c_uint64_ls__gr__ref__bitfield64_c_uint64_ls__gr__bool: .. das:function:: __bit_set(value: bitfield64:uint64<>&; mask: bitfield64:uint64<>; on: bool) .. _function-builtin___bit_set_bitfield16_c_uint16_ls__gr__ref__bitfield16_c_uint16_ls__gr__bool: .. das:function:: __bit_set(value: bitfield16:uint16<>&; mask: bitfield16:uint16<>; on: bool) ---- clz ^^^ .. _function-builtin_clz_uint64: .. das:function:: clz(bits: uint64) : uint64 Counts the number of leading zero bits in the 64-bit unsigned integer `bits`, returning 64 if the value is zero. :Arguments: * **bits** : uint64 .. _function-builtin_clz_uint: .. das:function:: clz(bits: uint) : uint ---- ctz ^^^ .. _function-builtin_ctz_uint64: .. das:function:: ctz(bits: uint64) : uint64 Counts the number of trailing zero bits in the 64-bit unsigned integer `bits`, returning 64 if the value is zero. :Arguments: * **bits** : uint64 .. _function-builtin_ctz_uint: .. das:function:: ctz(bits: uint) : uint ---- .. _function-builtin_mul128_uint64_uint64: .. das:function:: mul128(a: uint64; b: uint64) : urange64 Multiplies two 64-bit unsigned integers `a` and `b`, returning the full 128-bit result as a `urange64` containing the low and high 64-bit halves. :Arguments: * **a** : uint64 * **b** : uint64 popcnt ^^^^^^ .. _function-builtin_popcnt_uint64: .. das:function:: popcnt(bits: uint64) : uint64 Counts and returns the number of set (1) bits in the 64-bit unsigned integer `bits`. :Arguments: * **bits** : uint64 .. _function-builtin_popcnt_uint: .. das:function:: popcnt(bits: uint) : uint +++++++++ Intervals +++++++++ * :ref:`interval (arg0: uint; arg1: uint) : urange ` * :ref:`interval (arg0: int; arg1: int) : range ` * :ref:`interval (arg0: uint64; arg1: uint64) : urange64 ` * :ref:`interval (arg0: int64; arg1: int64) : range64 ` interval ^^^^^^^^ .. _function-builtin_interval_uint_uint: .. das:function:: interval(arg0: uint; arg1: uint) : urange Constructs a `urange` value from the two `uint` endpoints `arg0` (inclusive) and `arg1` (exclusive). :Arguments: * **arg0** : uint * **arg1** : uint .. _function-builtin_interval_int_int: .. das:function:: interval(arg0: int; arg1: int) : range .. _function-builtin_interval_uint64_uint64: .. das:function:: interval(arg0: uint64; arg1: uint64) : urange64 .. _function-builtin_interval_int64_int64: .. das:function:: interval(arg0: int64; arg1: int64) : range64 ++++ RTTI ++++ * :ref:`class_rtti_size (ptr: void?) : int ` .. _function-builtin_class_rtti_size_void_q_: .. das:function:: class_rtti_size(ptr: void?) : int Examines the RTTI (runtime type information) associated with the class at `ptr` and returns the size in bytes of its TypeInfo structure. :Arguments: * **ptr** : void? implicit +++++++++++++++++++++++++++++++ Initialization and finalization +++++++++++++++++++++++++++++++ * :ref:`using (arg0: block\<(das_string):void\>) ` .. _function-builtin_using_block_ls_das_string_c_void_gr_: .. das:function:: using(arg0: block<(das_string):void>) Creates a temporary `das_string` and passes it to the block, automatically managing its lifetime for the duration of the call. :Arguments: * **arg0** : block<( :ref:`das_string `):void> implicit ++++++++++ Algorithms ++++++++++ * :ref:`count (start: int = 0; step: int = 1) : iterator\ ` * :ref:`iter_range (foo: auto) : auto ` * :ref:`swap (var a: auto(TT)&; var b: auto(TT)&) : auto ` * :ref:`ucount (start: uint = 0x0; step: uint = 0x1) : iterator\ ` .. _function-builtin_count_int_int: .. das:function:: count(start: int = 0; step: int = 1) : iterator Creates an infinite iterator that yields integer values starting from `start` and incrementing by `step` on each iteration, intended for use as a counter alongside other sequences in a `for` loop. :Arguments: * **start** : int * **step** : int .. _function-builtin_iter_range_auto_0x521: .. das:function:: iter_range(foo: auto) : auto Creates a `range` from `0` to the length of the given iterable `foo`, useful for index-based iteration over containers. :Arguments: * **foo** : auto .. _function-builtin_swap_autoTT_ref__autoTT_ref__0x72d: .. das:function:: swap(a: auto(TT)&; b: auto(TT)&) : auto Exchanges the values of `a` and `b` in place, leaving each variable holding the other's former value. :Arguments: * **a** : auto(TT)\ & * **b** : auto(TT)\ & .. _function-builtin_ucount_uint_uint: .. das:function:: ucount(start: uint = 0x0; step: uint = 0x1) : iterator Creates an infinite iterator over unsigned integers beginning at `start` and incrementing by `step` on each iteration. :Arguments: * **start** : uint * **step** : uint ++++++ Memset ++++++ * :ref:`memset128 (left: void?; value: uint4; count: int) ` * :ref:`memset16 (left: void?; value: uint16; count: int) ` * :ref:`memset32 (left: void?; value: uint; count: int) ` * :ref:`memset64 (left: void?; value: uint64; count: int) ` * :ref:`memset8 (left: void?; value: uint8; count: int) ` .. _function-builtin_memset128_void_q__uint4_int: .. das:function:: memset128(left: void?; value: uint4; count: int) .. warning:: This is unsafe operation. Fills memory at `left` with `count` copies of the 128-bit `uint4` vector `value`. :Arguments: * **left** : void? implicit * **value** : uint4 * **count** : int .. _function-builtin_memset16_void_q__uint16_int: .. das:function:: memset16(left: void?; value: uint16; count: int) .. warning:: This is unsafe operation. Fills memory at `left` with `count` copies of the 16-bit `value`. :Arguments: * **left** : void? implicit * **value** : uint16 * **count** : int .. _function-builtin_memset32_void_q__uint_int: .. das:function:: memset32(left: void?; value: uint; count: int) .. warning:: This is unsafe operation. Fills memory at `left` with `count` copies of the 32-bit `value`. :Arguments: * **left** : void? implicit * **value** : uint * **count** : int .. _function-builtin_memset64_void_q__uint64_int: .. das:function:: memset64(left: void?; value: uint64; count: int) .. warning:: This is unsafe operation. Fills memory at `left` with `count` copies of the 64-bit `value`. :Arguments: * **left** : void? implicit * **value** : uint64 * **count** : int .. _function-builtin_memset8_void_q__uint8_int: .. das:function:: memset8(left: void?; value: uint8; count: int) .. warning:: This is unsafe operation. Fills memory at `left` with `count` copies of the 8-bit `value`, equivalent to the C `memset` function. :Arguments: * **left** : void? implicit * **value** : uint8 * **count** : int ++++++ Malloc ++++++ * :ref:`free (ptr: void?) ` * :ref:`malloc (size: uint64) : void? ` * :ref:`malloc_usable_size (ptr: void?) : uint64 ` .. _function-builtin_free_void_q_: .. das:function:: free(ptr: void?) .. warning:: This is unsafe operation. Frees memory previously allocated with `malloc`, following C-style manual memory management semantics. :Arguments: * **ptr** : void? implicit .. _function-builtin_malloc_uint64: .. das:function:: malloc(size: uint64) : void? .. warning:: This is unsafe operation. Allocates a block of uninitialized memory of the specified `size` in bytes, C-style, and returns a raw pointer to it; must be freed with `free`. :Arguments: * **size** : uint64 .. _function-builtin_malloc_usable_size_void_q_: .. das:function:: malloc_usable_size(ptr: void?) : uint64 .. warning:: This is unsafe operation. Returns the usable size in bytes of the memory block pointed to by `ptr`, as reported by the underlying allocator. :Arguments: * **ptr** : void? implicit +++++++++++++++++++ Compilation and AOT +++++++++++++++++++ * :ref:`compiling_file_name () : string ` * :ref:`compiling_module_name () : string ` * :ref:`get_module_file_name (name: string) : string ` * :ref:`reset_aot () ` * :ref:`set_aot () ` .. _function-builtin_compiling_file_name: .. das:function:: compiling_file_name() : string Returns the file name of the source file currently being compiled, useful for compile-time metaprogramming and diagnostics. .. _function-builtin_compiling_module_name: .. das:function:: compiling_module_name() : string Returns the name of the module currently being compiled, useful for compile-time metaprogramming and diagnostics. .. _function-builtin_get_module_file_name_string: .. das:function:: get_module_file_name(name: string) : string Returns the source file path of the module with the given name, or empty string if the module is not found or has no file (e.g. built-in modules). Pass an empty string to get the main script's file path. Only works during simulation (global variable initialization); at runtime requires `options rtti` to keep the program object alive. :Arguments: * **name** : string implicit .. _function-builtin_reset_aot: .. das:function:: reset_aot() Notifies the compiler that ahead-of-time code generation has finished, restoring normal compilation mode. .. _function-builtin_set_aot: .. das:function:: set_aot() Notifies the compiler that ahead-of-time code generation is now in progress. ++ GC ++ * :ref:`gc_active_root_count () : uint64 ` * :ref:`gc_thread_root_count () : uint64 ` * :ref:`gc_thread_root_report () ` * :ref:`gc_thread_root_report_detailed (max_nodes: uint64 = 0x14) ` * :ref:`gc_total_id () : uint64 ` .. _function-builtin_gc_active_root_count: .. das:function:: gc_active_root_count() : uint64 Returns the number of active GC roots across all threads. .. _function-builtin_gc_thread_root_count: .. das:function:: gc_thread_root_count() : uint64 Returns the number of GC roots on the current thread. .. _function-builtin_gc_thread_root_report: .. das:function:: gc_thread_root_report() Prints a summary report of GC roots on the current thread to the log. .. _function-builtin_gc_thread_root_report_detailed_uint64: .. das:function:: gc_thread_root_report_detailed(max_nodes: uint64 = 0x14) Prints a detailed report of GC roots and their nodes on the current thread to the log. The max_nodes parameter limits how many nodes per root are printed. :Arguments: * **max_nodes** : uint64 .. _function-builtin_gc_total_id: .. das:function:: gc_total_id() : uint64 Returns the total number of GC node IDs allocated since program start. Useful for detecting allocation leaks in tests.