10.1. Runtime type information library

The RTTI module exposes runtime type information and program introspection facilities. It allows querying module structure, type declarations, function signatures, annotations, and other compile-time metadata at runtime. Used primarily by macro libraries and code generation tools.

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

require rtti

10.1.1. Type aliases

rtti.bitfield ProgramFlags

Flags which represent state of the Program object, both during and after compilation.

Fields:
  • failToCompile (0x1) - indicates that the program failed to compile.

  • _unsafe (0x2) - indicates that the program contains unsafe code.

  • isCompiling (0x4) - indicates that the program is currently compiling.

  • isSimulating (0x8) - indicates that the program is currently simulating.

  • isCompilingMacros (0x10) - indicates that the program is currently compiling macros.

  • needMacroModule (0x20) - indicates that the program needs a macro module.

  • promoteToBuiltin (0x40) - indicates that the program is being promoted to a builtin module.

  • isDependency (0x80) - indicates that the program is a dependency module.

  • macroException (0x100) - indicates that a macro exception has occurred.

rtti.bitfield context_category_flags

Flags which specify type of the Context.

Fields:
  • dead (0x1) - indicates that the context is dead.

  • debug_context (0x2) - indicates that the context is a debug context.

  • thread_clone (0x4) - indicates that the context is a thread clone.

  • job_clone (0x8) - indicates that the context is a job clone.

  • opengl (0x10) - indicates that the context is an opengl context.

  • debugger_tick (0x20) - indicates that the context is a debugger tick.

  • debugger_attached (0x40) - indicates that the context has a debugger attached.

  • macro_context (0x80) - indicates that the context is a macro context (i.e. compiled macro module)

  • folding_context (0x100) - indicates that the context is a folding context (used during compilation or optimization for the purposes of folding constants)

  • audio (0x200) - indicates that the context is an audio context.

rtti.bitfield TypeInfoFlags

Flags which specify properties of the TypeInfo object (any rtti type).

Fields:
  • ref (0x1) - indicates that the type is a reference value.

  • refType (0x2) - indicates that the type is a reference type.

  • canCopy (0x4) - indicates that the type can be copied.

  • isPod (0x8) - indicates that the type is a plain old data type.

  • isRawPod (0x10) - indicates that the type is a raw plain old data type (without pointers or strings).

  • isConst (0x20) - indicates that the type is a const type.

  • isTemp (0x40) - indicates that the type is a temporary type.

  • isImplicit (0x80) - indicates that the type is an implicit type.

  • refValue (0x100) - indicates that the type is a reference value.

  • hasInitValue (0x200) - indicates that the type has an initial value.

  • isSmartPtr (0x400) - indicates that the type is a smart pointer.

  • isSmartPtrNative (0x800) - indicates that the type is a smart pointer native (smart_ptr_raw)

  • isHandled (0x1000) - indicates that the type is a handled type (annotation)

  • heapGC (0x2000) - indicates that the type needs marking by the garbage collector.

  • stringHeapGC (0x4000) - indicates that the type needs marking of strings by the garbage collector.

  • lockCheck (0x8000) - indicates that the type needs lock checking.

  • isPrivate (0x10000) - indicates that the type is private.

rtti.bitfield StructInfoFlags

Flags which represent properties of the StructInfo object (rtti object which represents structure type).

Fields:
  • _class (0x1) - This structure is a class.

  • _lambda (0x2) - This structure is a lambda.

  • heapGC (0x4) - This structure needs marking by the garbage collector.

  • stringHeapGC (0x8) - This structure needs marking of strings by the garbage collector.

  • lockCheck (0x10) - This structure needs lock checking.

rtti.bitfield ModuleFlags

Flags which represent the module’s state.

Fields:
  • builtIn (0x1) - This module is built-in.

  • promoted (0x2) - This module is promoted to a builtin module.

  • isPublic (0x4) - This module is public.

  • isModule (0x8) - This module is a module.

  • isSolidContext (0x10) - This module is a solid context (can’t be called from other contexts via pinvoke, global variables are cemented at locations)

  • fromExtraDependency (0x20) - This module is from an extra dependency.

  • doNotAllowUnsafe (0x40) - This module does not allow unsafe code.

  • wasParsedNameless (0x80) - This module was parsed nameless.

  • visibleEverywhere (0x100) - This module is visible everywhere.

  • skipLockCheck (0x200) - This module skips lock checking.

  • allowPodInscope (0x400) - This module allows pod inscope.

rtti.bitfield AnnotationDeclarationFlags

Flags which represent properties of the AnnotationDeclaration object.

Fields:
  • inherited (0x1) - Indicates that the annotation is inherited.

rtti.bitfield SimFunctionFlags

properties of the SimFunction object.

Fields:
  • aot (0x1) - Function is compiled ahead-of-time.

  • fastcall (0x2) - Function uses fastcall calling convention.

  • builtin (0x4) - Function is a builtin.

  • jit (0x8) - Function is JIT-compiled.

  • unsafe (0x10) - Function is unsafe.

  • cmres (0x20) - Function returns via caller-managed return space.

  • pinvoke (0x40) - Function uses platform invoke for external calls.

rtti.bitfield LocalVariableInfoFlags

properties of the LocalVariableInfo object.

Fields:
  • cmres (0x1) - Variable is a caller-managed return space variable.

rtti.variant RttiValue

Variant type which represents value of any annotation arguments and variable annotations.

Variants:
  • tBool : bool - boolean value

  • tInt : int - integer value

  • tUInt : uint - unsigned integer value

  • tInt64 : int64 - 64-bit integer value

  • tUInt64 : uint64 - 64-bit unsigned integer value

  • tFloat : float - floating point value

  • tDouble : double - double precision floating point value

  • tString : string - string value

  • nothing : any - no value

rtti.FileAccessPtr = smart_ptr<FileAccess>

Type alias for smart_ptr<FileAccess> — a reference-counted pointer to a FileAccess object, used as the standard way to pass file access to the compiler.

10.1.2. Constants

rtti.FUNCINFO_INIT = 0x1

Bit flag constant on FuncInfo.flags indicating that the function runs during Context initialization ([init] attribute).

rtti.FUNCINFO_BUILTIN = 0x2

Bit flag constant on FuncInfo.flags indicating that the function is a built-in (C++-bound) function rather than a daslang-defined one.

rtti.FUNCINFO_PRIVATE = 0x4

Bit flag constant on FuncInfo.flags indicating that the function has [private] visibility and cannot be called from other modules.

rtti.FUNCINFO_SHUTDOWN = 0x8

Bit flag constant on FuncInfo.flags indicating that the function runs during Context shutdown ([finalize] attribute).

rtti.FUNCINFO_LATE_INIT = 0x20

Bit flag constant on FuncInfo.flags indicating the function uses late initialization with a custom init order ([init(order)] attribute).

10.1.3. Enumerations

rtti.CompilationError

Enumeration which represents error type for each of the errors which compiler returns and various stages.

Values:
  • unspecified = 0 - Unspecified error.

  • mismatching_parentheses = 10001 - Mismatching parentheses.

  • mismatching_curly_bracers = 10002 - Mismatching curly braces.

  • string_constant_exceeds_file = 10003 - String constant exceeds file.

  • string_constant_exceeds_line = 10004 - String constant exceeds line.

  • unexpected_close_comment = 10005 - Unexpected close comment.

  • integer_constant_out_of_range = 10006 - Integer constant out of range.

  • comment_contains_eof = 10007 - Comment contains EOF (end of file).

  • invalid_escape_sequence = 10008 - Invalid escape sequence.

  • invalid_line_directive = 10009 - Invalid line directive.

  • syntax_error = 20000 - Syntax error, usually invalid grammar.

  • malformed_ast = 20001 - Malformed AST.

  • invalid_type = 30101 - Invalid type.

  • invalid_return_type = 30102 - Invalid return type.

  • invalid_argument_type = 30103 - Invalid argument type.

  • invalid_structure_field_type = 30104 - Invalid structure field type.

  • invalid_array_type = 30105 - Invalid array type.

  • invalid_table_type = 30106 - Invalid table type.

  • invalid_argument_count = 30107 - Invalid argument count.

  • invalid_variable_type = 30108 - Invalid variable type.

  • invalid_new_type = 30109 - Invalid new type.

  • invalid_index_type = 30110 - Invalid index type.

  • invalid_annotation = 30111 - Invalid annotation.

  • invalid_swizzle_mask = 30112 - Invalid swizzle mask.

  • invalid_initialization_type = 30113 - Invalid initialization type.

  • invalid_with_type = 30114 - Invalid with type.

  • invalid_override = 30115 - Invalid override.

  • invalid_name = 30116 - Invalid name.

  • invalid_array_dimension = 30117 - Invalid array dimension.

  • invalid_iteration_source = 30118 - Invalid iteration source.

  • invalid_loop = 30119 - Invalid loop.

  • invalid_label = 30120 - Invalid label.

  • invalid_enumeration = 30121 - Invalid enumeration.

  • invalid_option = 30122 - Invalid or unsupported option.

  • invalid_member_function = 30123 - Invalid member function.

  • function_already_declared = 30201 - Function already declared.

  • argument_already_declared = 30202 - Argument already declared.

  • local_variable_already_declared = 30203 - Local variable already declared.

  • global_variable_already_declared = 30204 - Global variable already declared.

  • structure_field_already_declared = 30205 - Structure field already declared.

  • structure_already_declared = 30206 - Structure already declared.

  • structure_already_has_initializer = 30207 - Structure already has initializer.

  • enumeration_already_declared = 30208 - Enumeration already declared.

  • enumeration_value_already_declared = 30209 - Enumeration value already declared.

  • type_alias_already_declared = 30210 - Type alias already declared.

  • field_already_initialized = 30211 - Field already initialized.

  • type_not_found = 30301 - Type not found.

  • structure_not_found = 30302 - Structure not found.

  • operator_not_found = 30303 - Operator not found.

  • function_not_found = 30304 - Function not found.

  • variable_not_found = 30305 - Variable not found.

  • handle_not_found = 30306 - Handle not found.

  • annotation_not_found = 30307 - Annotation not found.

  • enumeration_not_found = 30308 - Enumeration not found.

  • enumeration_value_not_found = 30309 - Enumeration value not found.

  • type_alias_not_found = 30310 - Type alias not found.

  • bitfield_not_found = 30311 - Bitfield not found.

  • cant_initialize = 30401 - Can’t initialize.

  • cant_dereference = 30501 - Can’t dereference (not a pointer or dereferencable type).

  • cant_index = 30502 - Can’t index (not an array, table, or indexable type).

  • cant_get_field = 30503 - Can’t get field (not a structure or table type).

  • cant_write_to_const = 30504 - Can’t write to const.

  • cant_move_to_const = 30505 - Can’t move to const.

  • cant_write_to_non_reference = 30506 - Can’t write to non-reference.

  • cant_copy = 30507 - Can’t copy.

  • cant_move = 30508 - Can’t move.

  • cant_pass_temporary = 30509 - Can’t pass temporary value to non-temporary parameter.

  • condition_must_be_bool = 30601 - Condition must be boolean.

  • condition_must_be_static = 30602 - Condition must be static (for ‘static_if’ and ‘static_elif’)

  • cant_pipe = 30701 - Can’t pipe (invalid left-hand side or right-hand side).

  • invalid_block = 30801 - Invalid block.

  • return_or_break_in_finally = 30802 - Return or break in finally section is not allowed.

  • module_not_found = 30901 - Module not found.

  • module_already_has_a_name = 30902 - Module already has a name.

  • cant_new_handle = 31001 - Can’t new handled type.

  • bad_delete = 31002 - Bad delete.

  • cant_infer_generic = 31100 - Can’t infer generic.

  • cant_infer_missing_initializer = 31101 - Can’t infer missing initializer.

  • cant_infer_mismatching_restrictions = 31102 - Can’t infer mismatching restrictions.

  • invalid_cast = 31200 - Invalid cast.

  • incompatible_cast = 31201 - Incompatible cast.

  • unsafe = 31300 - Unsafe operation.

  • index_out_of_range = 31400 - Index out of range.

  • expecting_return_value = 32101 - Expecting return value.

  • not_expecting_return_value = 32102 - Not expecting return value (void function or block).

  • invalid_return_semantics = 32103 - Invalid return semantics.

  • invalid_yield = 32104 - Invalid yield.

  • typeinfo_reference = 39901 - ‘typeinfo’ error, the type is a reference.

  • typeinfo_auto = 39902 - ‘typeinfo’ error, the type is auto.

  • typeinfo_undefined = 39903 - ‘typeinfo’ error, the type is undefined.

  • typeinfo_dim = 39904 - ‘typeinfo’ error, the type is not a static array.

  • typeinfo_macro_error = 39905 - Macro returned error.

  • static_assert_failed = 40100 - Static assert failed.

  • run_failed = 40101 - Run failed (attempt of folding constant function without side-effects failed)

  • annotation_failed = 40102 - Annotation throw panic during compile time.

  • concept_failed = 40103 - Concept throw panic during compile time.

  • not_all_paths_return_value = 40200 - Not all paths return value.

  • assert_with_side_effects = 40201 - Assert with side effects.

  • only_fast_aot_no_cpp_name = 40202 - Only fast AOT no C++ name.

  • aot_side_effects = 40203 - AOT side effects.

  • no_global_heap = 40204 - No global heap is specified, but program requests it.

  • no_global_variables = 40205 - No global variables are allowed in this context.

  • unused_function_argument = 40206 - Unused function argument.

  • unsafe_function = 40207 - Unsafe function.

  • too_many_infer_passes = 41000 - Too many infer passes.

  • missing_node = 50100 - Missing simulation node.

rtti.ConstMatters

Yes or no flag which indicates if constant flag of the type matters (during comparison).

Values:
  • no = 0 - const does not matter, when comparing types.

  • yes = 1 - const matters, when comparing types.

rtti.RefMatters

Yes or no flag which indicates if reference flag of the type matters (during comparison).

Values:
  • no = 0 - Ref does not matter, when comparing types.

  • yes = 1 - Ref matters, when comparing types.

rtti.TemporaryMatters

Yes or no flag which indicates if temporary flag of the type matters (during comparison).

Values:
  • no = 0 - Temporary does not matter, when comparing types.

  • yes = 1 - Temporary matters, when comparing types.

rtti.Type

One of the fundamental (base) types of any type object.

Values:
  • none = 0 - No type specified (not void, not anything).

  • autoinfer = 1 - Auto-inferred type (auto)

  • alias = 2 - Type alias.

  • option = 3 - Optional type (foo|bar|…)

  • typeDecl = 4 - Type declaration typedecl(expr…)

  • typeMacro = 5 - Type macro. $type_macro_name(args…)

  • fakeContext = 6 - Fake context type (used for internal purposes to pass context as argument to C++ functions)

  • fakeLineInfo = 7 - Fake line info type (used for internal purposes to pass line info as argument to C++ functions)

  • anyArgument = 8 - Any argument type (only available for C++ interop functions, TypeInfo is provided)

  • tVoid = 9 - Void type.

  • tBool = 10 - Boolean type.

  • tInt8 = 11 - 8-bit integer type.

  • tUInt8 = 12 - 8-bit unsigned integer type.

  • tInt16 = 13 - 16-bit integer type.

  • tUInt16 = 14 - 16-bit unsigned integer type.

  • tInt64 = 15 - 64-bit integer type.

  • tUInt64 = 16 - 64-bit unsigned integer type.

  • tInt = 17 - 32-bit integer type.

  • tInt2 = 18 - vector of 2 32-bit integers.

  • tInt3 = 19 - vector of 3 32-bit integers.

  • tInt4 = 20 - vector of 4 32-bit integers.

  • tUInt = 21 - 32-bit unsigned integer type.

  • tUInt2 = 22 - vector of 2 32-bit unsigned integers.

  • tUInt3 = 23 - vector of 3 32-bit unsigned integers.

  • tUInt4 = 24 - vector of 4 32-bit unsigned integers.

  • tFloat = 25 - 32-bit floating point type.

  • tFloat2 = 26 - vector of 2 32-bit floating point numbers.

  • tFloat3 = 27 - vector of 3 32-bit floating point numbers.

  • tFloat4 = 28 - vector of 4 32-bit floating point numbers.

  • tDouble = 29 - 64-bit floating point type.

  • tRange = 30 - 32-bit range type, similar to vector of two 32-bit integers.

  • tURange = 31 - 32-bit unsigned range type, similar to vector of two 32-bit unsigned integers.

  • tRange64 = 32 - 64-bit range type, similar to vector of two 64-bit integers.

  • tURange64 = 33 - 64-bit unsigned range type, similar to vector of two 64-bit unsigned integers.

  • tString = 34 - String type.

  • tStructure = 35 - Structure type.

  • tHandle = 36 - Handle type (C++ type specified via annotation).

  • tEnumeration = 37 - 32-bit enumeration type.

  • tEnumeration8 = 38 - 8-bit enumeration type.

  • tEnumeration16 = 39 - 16-bit enumeration type.

  • tEnumeration64 = 40 - 64-bit enumeration type.

  • tBitfield = 41 - 32-bit bitfield type.

  • tBitfield8 = 42 - 8-bit bitfield type.

  • tBitfield16 = 43 - 16-bit bitfield type.

  • tBitfield64 = 44 - 64-bit bitfield type.

  • tPointer = 45 - Pointer type.

  • tFunction = 46 - Function type.

  • tLambda = 47 - Lambda type.

  • tIterator = 48 - Iterator type.

  • tArray = 49 - Array type.

  • tTable = 50 - Table type.

  • tBlock = 51 - Block type.

  • tTuple = 52 - Tuple type.

  • tVariant = 53 - Variant type.

10.1.4. Handled structures

rtti.CodeOfPolicies
Fields:
  • aot : bool - Object which holds compilation and simulation settings and restrictions.

  • aot_lib : bool - Whether ahead-of-time compilation is enabled.

  • standalone_context : bool - AOT library mode.

  • aot_module : bool - Whether standalone context AOT compilation is enabled.

  • aot_macros : bool - Specifies to AOT if we are compiling a module, or a final program.

  • paranoid_validation : bool - Enables AOT of macro code (like ‘qmacro_block’ etc).

  • cross_platform : bool - Whether paranoid validation is enabled (extra checks, no optimizations).

  • aot_result : das_string - Whether cross-platform AOT is enabled (if not, we generate code for the current platform).

  • completion : bool - File name for AOT output (if not set, we generate a temporary file).

  • export_all : bool - If we are in code completion mode.

  • serialize_main_module : bool - Export all functions and global variables.

  • keep_alive : bool - If not set, we recompile main module each time.

  • very_safe_context : bool - Keep context alive after main function.

  • always_report_candidates_threshold : int - Whether to use very safe context (delete of data is delayed, to avoid table[foo]=table[bar] lifetime bugs).

  • max_infer_passes : int - Threshold for reporting candidates for function calls. If less than this number, we always report them.

  • stack : uint - Maximum number of inference passes.

  • intern_strings : bool - Stack size.

  • persistent_heap : bool - Whether to intern strings.

  • multiple_contexts : bool - Whether to use persistent heap (or linear heap).

  • heap_size_hint : uint - Whether multiple contexts are allowed (pinvokes between contexts).

  • string_heap_size_hint : uint - Heap size hint.

  • solid_context : bool - String heap size hint.

  • macro_context_persistent_heap : bool - Whether to use solid context (global variables are cemented at locations, can’t be called from other contexts via pinvoke).

  • macro_context_collect : bool - Whether macro context uses persistent heap.

  • max_static_variables_size : uint64 - Whether macro context does garbage collection.

  • max_heap_allocated : uint64 - Maximum size of static variables.

  • max_string_heap_allocated : uint64 - Maximum heap allocated.

  • rtti : bool - Maximum string heap allocated.

  • unsafe_table_lookup : bool - Whether to enable RTTI.

  • relaxed_pointer_const : bool - Whether to allow unsafe table lookups (via [] operator).

  • version_2_syntax : bool - Whether to relax pointer constness rules.

  • gen2_make_syntax : bool - Allows use of version 2 syntax.

  • relaxed_assign : bool - Whether to use gen2 make syntax.

  • no_unsafe : bool - Allows relaxing of the assignment rules.

  • local_ref_is_unsafe : bool - Disables all unsafe operations.

  • no_global_variables : bool - Local references are considered unsafe.

  • no_global_variables_at_all : bool - Disallows global variables in this context (except for generated).

  • no_global_heap : bool - Disallows global variables at all in this context.

  • only_fast_aot : bool - Disallows global heap in this context.

  • aot_order_side_effects : bool - Only fast AOT, no C++ name generation.

  • no_unused_function_arguments : bool - Whether to consider side effects during AOT ordering.

  • no_unused_block_arguments : bool - Errors on unused function arguments.

  • allow_block_variable_shadowing : bool - Errors on unused block arguments.

  • allow_local_variable_shadowing : bool - Allows block variable shadowing.

  • allow_shared_lambda : bool - Allows local variable shadowing.

  • ignore_shared_modules : bool - Allows shared lambdas.

  • default_module_public : bool - Ignore shared modules during compilation.

  • no_deprecated : bool - Default module mode is public.

  • no_aliasing : bool - Disallows use of deprecated features.

  • strict_smart_pointers : bool - Disallows aliasing (if aliasing is allowed, temporary lifetimes are extended).

  • no_init : bool - Enables strict smart pointer checks.

  • strict_unsafe_delete : bool - Disallows use of ‘init’ in structures.

  • no_members_functions_in_struct : bool - Enables strict unsafe delete checks.

  • no_local_class_members : bool - Disallows member functions in structures.

  • report_invisible_functions : bool - Disallows local class members.

  • report_private_functions : bool - Report invisible functions.

  • strict_properties : bool - Report private functions.

  • no_optimizations : bool - Enables strict property checks.

  • fail_on_no_aot : bool - Disables all optimizations.

  • fail_on_lack_of_aot_export : bool - Fails compilation if AOT is not available.

  • log_compile_time : bool - Fails compilation if AOT export is not available.

  • log_total_compile_time : bool - Log compile time.

  • no_fast_call : bool - Log total compile time.

  • scoped_stack_allocator : bool - Disables fast call optimization.

  • force_inscope_pod : bool - Reuse stack memory after variables go out of scope.

  • log_inscope_pod : bool - Force in-scope for POD-like types.

  • debugger : bool - Log in-scope for POD-like types.

  • debug_infer_flag : bool - Enables debugger support.

  • debug_module : das_string - Enables debug inference flag.

  • profiler : bool - Sets debug module (module which will be loaded when IDE connects).

  • profile_module : das_string - Enables profiler support.

  • threadlock_context : bool - Sets profile module (module which will be loaded when profiler connects).

  • jit_enabled : bool - Enables threadlock context.

  • jit_module : das_string - JIT enabled - if enabled, JIT will be used to compile code at runtime.

  • jit_jit_all_functions : bool - JIT module - module loaded when -jit is specified.

  • jit_debug_info : bool - JIT all functions - if enabled, JIT will compile all functions in the module.

  • jit_use_dll_mode : bool - JIT debug info - if enabled, JIT will generate debug info for JIT compiled code.

  • emit_prologue : bool - JIT dll mode - if enabled, JIT will generate DLL’s into JIT output folder and load them from there.

  • jit_output_folder : das_string - JIT output folder (where JIT compiled code will be stored).

  • jit_opt_level : int - JIT optimization level for compiled code (0-3).

  • jit_size_level : int - JIT size optimization level for compiled code (0-3).

  • jit_path_to_shared_lib : das_string - Path to shared library, which is used in JIT.

  • jit_path_to_linker : das_string - Path to linker, which is used in JIT.

rtti.FileInfo

Information about a single file stored in the FileAccess object.

Fields:
  • name : das_string - File name.

  • tabSize : int - Tab size for this file.

rtti.LineInfo

Information about a section of the file stored in the FileAccess object.

Fields:
  • fileInfo : FileInfo? - File information object.

  • column : uint - Column number (1-based).

  • line : uint - Line number (1-based).

  • last_column : uint - Last column number (1-based).

  • last_line : uint - Last line number (1-based).

rtti.Context
Context.getInitSemanticHash(): uint64

Property-like accessor that returns the uint64 semantic hash of the initialization code for the given Context, useful for detecting code changes.

Context.totalFunctions(): int

Property-like accessor that returns the total number of registered SimFunction entries in the given Context.

Context.totalVariables(): int

Property-like accessor that returns the total number of global variables registered in the given Context.

Context.getCodeAllocatorId(): uint64

Property-like accessor that returns a non-persistent unique integer ID of the code (node) allocator associated with the given Context.

Properties:
  • getInitSemanticHash : uint64

  • totalFunctions : int

  • totalVariables : int

  • getCodeAllocatorId : uint64

Object which holds single Daslang Context. Context is the result of the simulation of the Daslang program.

Fields:
  • breakOnException : bool - Calls breakpoint when exception is thrown.

  • alwaysErrorOnException : bool - Always error on exception.

  • alwaysStackWalkOnException : bool - Always stack walk on exception.

  • name : das_string - Context name.

  • category : context_category_flags - Context category flags.

  • exceptionAt : LineInfo - Exception at line info.

  • exception : string - Exception message.

  • last_exception : string - Last exception message.

  • contextMutex : recursive_mutex? - Context mutex.

rtti.Error

Object which holds information about compilation error or exception.

Fields:
rtti.FileAccess

Object which holds collection of files as well as means to access them (Project).

rtti.Module

Collection of types, aliases, functions, classes, macros etc under a single namespace.

Fields:
rtti.ModuleGroup

Collection of modules.

rtti.AnnotationArgument

Single argument of the annotation, typically part of the AnnotationArgumentList.

Fields:
  • basicType : Type - type of the argument value

  • name : das_string - argument name

  • sValue : das_string - string value

  • iValue : int - integer value

  • fValue : float - float value

  • bValue : bool - boolean value

  • at : LineInfo - line info where the argument is defined

rtti.Program
Program.getThisModule(): Module?

Property-like accessor that returns the Module pointer for the module currently being inferred in the given Program.

Program.getDebugger(): bool

Property-like accessor that returns true if the debugger is attached and enabled for the given Program.

Properties:
  • getThisModule : Module?

  • getDebugger : bool

Object representing full information about Daslang program during and after compilation (but not the simulated result of the program).

Fields:
  • thisNamespace : das_string - namespace of the program

  • thisModuleName : das_string - module name

  • totalFunctions : int - total number of functions in the program

  • totalVariables : int - total number of variables in the program

  • errors : vector<Error> - compilation errors and exceptions

  • globalStringHeapSize : uint - size of the global string heap

  • initSemanticHashWithDep : uint64 - initial semantic hash with dependencies

  • flags : ProgramFlags - program flags

  • _options : AnnotationArgumentList - program options

  • policies : CodeOfPolicies - code of policies

rtti.Annotation
Annotation.isTypeAnnotation(): bool

Property-like accessor that returns true if the given Annotation is a TypeAnnotation (defines a handled type).

Annotation.isBasicStructureAnnotation(): bool

Property-like accessor that returns true if the given Annotation is a BasicStructureAnnotation, which exposes C++ struct fields to daslang.

Annotation.isStructureAnnotation(): bool

Property-like accessor that returns true if the given Annotation is a structure annotation (applied to struct declarations).

Annotation.isStructureTypeAnnotation(): bool

Property-like accessor that returns true if the given Annotation is a StructureTypeAnnotation, which binds a C++ class as a daslang handled struct.

Annotation.isFunctionAnnotation(): bool

Property-like accessor that returns true if the given Annotation is a FunctionAnnotation (applied to functions).

Annotation.isEnumerationAnnotation(): bool

Property-like accessor that returns true if the given Annotation is an EnumerationAnnotation.

Properties:
  • isTypeAnnotation : bool

  • isBasicStructureAnnotation : bool

  • isStructureAnnotation : bool

  • isStructureTypeAnnotation : bool

  • isFunctionAnnotation : bool

  • isEnumerationAnnotation : bool

Handled type or macro.

Fields:
  • name : das_string - name of the annotation

  • cppName : das_string - name of the associated C++ type or macro

  • _module : Module? - module where the annotation is defined

rtti.AnnotationDeclaration

Annotation declaration, its location, and arguments.

Fields:
rtti.TypeAnnotation
TypeAnnotation.is_any_vector(): bool

Property-like accessor that returns true if the given TypeAnnotation wraps any C++ vector-like container (e.g., std::vector).

TypeAnnotation.canMove(): bool

Property-like accessor that returns true if the given TypeAnnotation supports move semantics.

TypeAnnotation.canCopy(): bool

Property-like accessor that returns true if the given TypeAnnotation supports copy semantics.

TypeAnnotation.canClone(): bool

Property-like accessor that returns true if the given TypeAnnotation supports the clone operation.

TypeAnnotation.isPod(): bool

Property-like accessor that returns true if the given TypeAnnotation is a POD (plain old data) type — no constructor, destructor, or special semantics.

TypeAnnotation.isRawPod(): bool

Property-like accessor that returns true if the given TypeAnnotation is a raw POD type — a basic value type excluding pointers and strings.

TypeAnnotation.isRefType(): bool

Property-like accessor that returns true if the given TypeAnnotation is always passed by reference, or is itself a reference type.

TypeAnnotation.hasNonTrivialCtor(): bool

Property-like accessor that returns true if the given TypeAnnotation has a non-trivial constructor (requires explicit initialization).

TypeAnnotation.hasNonTrivialDtor(): bool

Property-like accessor that returns true if the given TypeAnnotation has a non-trivial destructor (requires explicit finalization).

TypeAnnotation.hasNonTrivialCopy(): bool

Property-like accessor that returns true if the given TypeAnnotation has non-trivial copy semantics (i.e., a custom copy constructor).

TypeAnnotation.canBePlacedInContainer(): bool

Property-like accessor that returns true if values of the given TypeAnnotation can be stored inside arrays, tables, or other containers.

TypeAnnotation.isLocal(): bool

Property-like accessor that returns true if the given TypeAnnotation can be used as a local variable type within a function.

TypeAnnotation.canNew(): bool

Property-like accessor that returns true if the given TypeAnnotation supports heap allocation via new.

TypeAnnotation.canDelete(): bool

Property-like accessor that returns true if values of the given TypeAnnotation can be explicitly deleted.

TypeAnnotation.needDelete(): bool

Property-like accessor that returns true if values of the given TypeAnnotation require explicit delete to free resources.

TypeAnnotation.canDeletePtr(): bool

Property-like accessor that returns true if a pointer to the given TypeAnnotation type can be explicitly deleted.

TypeAnnotation.isIterable(): bool

Property-like accessor that returns true if the given TypeAnnotation supports iteration via for.

TypeAnnotation.isShareable(): bool

Property-like accessor that returns true if the given TypeAnnotation can be shared across multiple Context objects.

TypeAnnotation.isSmart(): bool

Property-like accessor that returns true if the given TypeAnnotation represents a smart_ptr managed type.

TypeAnnotation.avoidNullPtr(): bool

Property-like accessor that returns true if the given TypeAnnotation requires pointers to its type to be non-null (i.e., must be initialized on creation).

TypeAnnotation.sizeOf(): uint64

Property-like accessor that returns the size in bytes of the type described by the given TypeAnnotation.

TypeAnnotation.alignOf(): uint64

Property-like accessor that returns the memory alignment requirement (in bytes) of the type described by the given TypeAnnotation.

Properties:
  • is_any_vector : bool

  • canMove : bool

  • canCopy : bool

  • canClone : bool

  • isPod : bool

  • isRawPod : bool

  • isRefType : bool

  • hasNonTrivialCtor : bool

  • hasNonTrivialDtor : bool

  • hasNonTrivialCopy : bool

  • canBePlacedInContainer : bool

  • isLocal : bool

  • canNew : bool

  • canDelete : bool

  • needDelete : bool

  • canDeletePtr : bool

  • isIterable : bool

  • isShareable : bool

  • isSmart : bool

  • avoidNullPtr : bool

  • sizeOf : uint64

  • alignOf : uint64

Handled type.

Fields:
  • name : das_string - name of the type annotation

  • cppName : das_string - name of the associated C++ type

  • _module : Module? - module where the annotation is defined

rtti.BasicStructureAnnotation
BasicStructureAnnotation.fieldCount(): int

Property-like accessor that returns the number of fields declared in the given BasicStructureAnnotation.

Properties:
  • fieldCount : int

Handled type which represents a structure-like annotation for exposing C++ types to daslang.

Fields:
  • name : das_string - Name of the annotation

  • cppName : das_string - C++ class name used in AOT code generation

rtti.EnumValueInfo

Single element of enumeration, its name and value.

Fields:
  • name : string - name of the enumeration value

  • value : int64 - value of the enumeration value

rtti.EnumInfo

Type object which represents enumeration.

Fields:
  • name : string - name of the enumeration

  • module_name : string - module where the enumeration is defined

  • fields : EnumValueInfo?? - fields in the enumeration

  • count : uint - number of fields in the enumeration

  • hash : uint64 - hash of the enumeration

rtti.StructInfo

Type object which represents structure or class.

Fields:
  • name : string - name of the structure

  • module_name : string - module where the structure is defined

  • fields : VarInfo?? - fields in the structure

  • hash : uint64 - hash of the structure

  • init_mnh : uint64 - hash of the structure initializer

  • flags : StructInfoFlags - flags associated with the structure

  • count : uint - number of fields in the structure

  • size : uint - size of the structure in bytes

  • firstGcField : uint - index of the first GC field in the structure, i.e. field which requires garbage collection marking

rtti.TypeInfo
TypeInfo.enumType(): EnumInfo?

Property-like accessor that returns the EnumInfo pointer describing the underlying enumeration for the given enum TypeAnnotation.

TypeInfo.isRef(): bool

Property-like accessor that returns true if the given TypeInfo describes a reference (&) type.

TypeInfo.isRefType(): bool

Property-like accessor that returns true if the given TypeAnnotation is always passed by reference, or is itself a reference type.

TypeInfo.isRefValue(): bool

Property-like accessor that returns true if the given TypeInfo describes a ref-value type (boxed value accessed by reference).

TypeInfo.canCopy(): bool

Property-like accessor that returns true if the given TypeAnnotation supports copy semantics.

TypeInfo.isPod(): bool

Property-like accessor that returns true if the given TypeAnnotation is a POD (plain old data) type — no constructor, destructor, or special semantics.

TypeInfo.isRawPod(): bool

Property-like accessor that returns true if the given TypeAnnotation is a raw POD type — a basic value type excluding pointers and strings.

TypeInfo.isConst(): bool

Property-like accessor that returns true if the given TypeInfo describes a const-qualified type.

TypeInfo.isTemp(): bool

Property-like accessor that returns true if the given TypeInfo describes a temporary (#) type that cannot be captured or stored.

TypeInfo.isImplicit(): bool

Property-like accessor that returns true if the given TypeInfo describes an implicit (compiler-inferred) type.

TypeInfo.annotation(): TypeAnnotation?

Property-like accessor that returns the Annotation pointer associated with the given TypeInfo.

TypeInfo.annotation_or_name(): TypeAnnotation?

Property-like accessor that returns the annotation name if one exists, otherwise returns the raw type name from the given TypeInfo.

TypeInfo.structType(): StructInfo?

Property-like accessor that returns the StructInfo pointer for the struct described by the given TypeInfo, or null if not a struct type.

Properties:
  • enumType : EnumInfo?

  • isRef : bool

  • isRefType : bool

  • isRefValue : bool

  • canCopy : bool

  • isPod : bool

  • isRawPod : bool

  • isConst : bool

  • isTemp : bool

  • isImplicit : bool

  • annotation : TypeAnnotation?

  • annotation_or_name : TypeAnnotation?

  • structType : StructInfo?

Object which represents any Daslang type.

Fields:
  • firstType : TypeInfo? - first type parameter

  • secondType : TypeInfo? - second type parameter

  • argTypes : TypeInfo?? - argument types list

  • argNames : string? - argument names list

  • dim : uint? - dimensions list

  • hash : uint64 - hash of the type

  • _type : Type - kind of the type

  • basicType : Type - basic type category

  • flags : TypeInfoFlags - flags associated with the type

  • size : uint - size of the type in bytes

  • argCount : uint - number of arguments in the type

  • dimSize : uint - number of dimensions in the type

rtti.VarInfo

Object which represents variable declaration.

Fields:
  • firstType : TypeInfo? - first type parameter

  • secondType : TypeInfo? - second type parameter

  • argTypes : TypeInfo?? - argument types list

  • argNames : string? - argument names list

  • hash : uint64 - hash of the type

  • basicType : Type - basic type category

  • flags : TypeInfoFlags - flags associated with the type

  • size : uint - size of the type in bytes

  • argCount : uint - number of arguments in the type

  • dimSize : uint - number of dimensions in the type

  • value : any - value of the variable

  • sValue : string - string value of the variable

  • name : string - name of the variable

  • annotation_arguments : AnnotationArguments? - annotation arguments

  • offset : uint - offset of the variable in the structure

  • nextGcField : uint - next garbage collection field in the structure, which requires garbage collection marking

rtti.LocalVariableInfo

Object which represents local variable declaration.

Fields:
  • firstType : TypeInfo? - first type parameter

  • secondType : TypeInfo? - second type parameter

  • argTypes : TypeInfo?? - argument types list

  • argNames : string? - argument names list

  • hash : uint64 - hash of the type

  • basicType : Type - basic type category

  • flags : TypeInfoFlags - flags associated with the type

  • size : uint - size of the type in bytes

  • argCount : uint - number of arguments in the type

  • dimSize : uint - number of dimensions in the type

  • visibility : LineInfo - visibility information

  • name : string - name of the variable

  • stackTop : uint - stack top offset

  • localFlags : LocalVariableInfoFlags - local variable flags

rtti.FuncInfo

Object which represents function declaration.

Fields:
  • name : string - function name

  • cppName : string - C++ name (for the builtin functions)

  • fields : VarInfo?? - function parameters

  • result : TypeInfo? - function result type

  • locals : LocalVariableInfo?? - local variables (with visibility info)

  • globals : VarInfo?? - accessed global variables

  • hash : uint64 - hash of the function

  • flags : uint - flags associated with the function

  • count : uint - number of arguments in the function

  • stackSize : uint - stack size in bytes

  • localCount : uint - number of local variables

  • globalCount : uint - number of accessed global variables

rtti.SimFunction
SimFunction.lineInfo(): LineInfo const?

Property-like accessor that returns the LineInfo (source location) associated with the given function’s FuncInfo.

Properties:

Object which represents simulated function in the Context.

Fields:
  • name : string - original function name

  • mangledName : string - mangled function name (with arguments and types encoded)

  • debugInfo : FuncInfo? - pointer to the function debug info, if available

  • mangledNameHash : uint64 - hash of the mangled function name

  • stackSize : uint - stack size in bytes

  • flags : SimFunctionFlags - flags associated with the function

rtti.DebugInfoHelper

Helper object which holds debug information about the simulated program.

Fields:
  • rtti : bool - The RTTI context pointer.

10.1.5. Typeinfo macros

rtti.rtti_typeinfo

Typeinfo macro that provides compile-time access to RTTI type information structures. Typeinfo macro rtti_typeinfo

10.1.6. Handled types

rtti.recursive_mutex

Handled type wrapping a system std::recursive_mutex, used with lock_mutex for thread-safe access to shared data across contexts.

rtti.AnnotationArguments

Handled type representing a collection of annotation arguments, typically the raw argument list parsed from an annotation declaration.

rtti.AnnotationArgumentList

Handled type representing an ordered list of annotation arguments and properties, providing indexed and named access to argument entries.

rtti.AnnotationList

Handled type representing all annotations attached to a single object (function, structure, or variable), iterable via each.

10.1.7. Initialization and finalization

rtti.CodeOfPolicies(): CodeOfPolicies

Constructs a default-initialized CodeOfPolicies structure, which controls compiler behavior and optimization settings.

10.1.7.1. LineInfo

rtti.LineInfo(): LineInfo

Constructs a default-initialized LineInfo structure representing source file location (file, line, column).

rtti.LineInfo(arg0: FileInfo?; arg1: int; arg2: int; arg3: int; arg4: int): LineInfo

rtti.RttiValue_nothing(): auto

Constructs an RttiValue variant set to the nothing alternative, representing an absent or void value.

10.1.7.2. using

rtti.using(arg0: block<(CodeOfPolicies):void>)

Creates a temporary RTTI helper object (e.g., Program, DebugInfoHelper) scoped to the given block, automatically finalized on block exit.

Arguments:
rtti.using(arg0: block<(ModuleGroup):void>)
rtti.using(arg0: block<(recursive_mutex):void>)

10.1.8. Type access

10.1.8.1. arg_names

rtti.arg_names(info: TypeInfo): auto

Iterates through the argument names of an RTTI type, yielding each name as a string — used for inspecting function or call-site parameter names.

Arguments:
rtti.arg_names(info: VarInfo): auto

10.1.8.2. arg_types

rtti.arg_types(info: VarInfo): auto

Iterates through the argument types of an RTTI type, yielding each element as a TypeInfo pointer — used for inspecting function or call-site parameter types.

Arguments:
rtti.arg_types(info: TypeInfo): auto

rtti.builtin_is_same_type(a: TypeInfo const?; b: TypeInfo const?; refMatters: RefMatters; cosntMatters: ConstMatters; tempMatters: TemporaryMatters; topLevel: bool): bool

Returns true if two TypeInfo pointers describe the same type, with flags controlling whether ref, const, temp, and other qualifiers are included in the comparison.

Arguments:

10.1.8.3. each_dim

rtti.each_dim(info: TypeInfo): auto

Iterates through the dimension sizes of a fixed-size array TypeInfo, yielding each int dimension value (e.g., int[3][4] yields 3 then 4).

Arguments:
rtti.each_dim(info: VarInfo): auto

rtti.get_das_type_name(type: Type): string

Returns the canonical string name of the given Type enumeration value (e.g., tInt"int").

Arguments:

10.1.8.4. get_dim

rtti.get_dim(typeinfo: VarInfo; index: int): int

Returns the dimension size (int) at the specified index for a fixed-size array type described by TypeInfo.

Arguments:
  • typeinfo : VarInfo implicit

  • index : int

rtti.get_dim(typeinfo: TypeInfo; index: int): int

rtti.get_type_align(type: TypeInfo?): int

Returns the memory alignment (int, in bytes) of the type described by the given TypeInfo.

Arguments:
rtti.get_type_size(type: TypeInfo?): int

Returns the size (int, in bytes) of the type described by the given TypeInfo.

Arguments:

10.1.8.5. is_compatible_cast

rtti.is_compatible_cast(from: StructInfo const?; to: StructInfo const?): bool

Returns true if an object of type from (StructInfo) can be safely cast to type to (StructInfo), following the class hierarchy.

Arguments:
rtti.is_compatible_cast(a: StructInfo; b: StructInfo): auto

rtti.is_same_type(a: TypeInfo; b: TypeInfo; refMatters: RefMatters = RefMatters.yes; constMatters: ConstMatters = ConstMatters.yes; temporaryMatters: TemporaryMatters = TemporaryMatters.yes; topLevel: bool = true): auto

Returns true if two TypeInfo objects describe the same type, with flags controlling comparison of qualifiers (ref, const, temp, etc.).

Arguments:

10.1.9. Rtti context access

rtti.class_info(cl: auto): StructInfo const?

Returns a StructInfo pointer for the given class instance, enabling runtime introspection of its fields and annotations via RTTI.

Arguments:
  • cl : auto

rtti.context_for_each_function(blk: block<(info:FuncInfo):void>): auto

Iterates through all functions in the given Context, yielding a FuncInfo pointer for each registered function.

Arguments:
rtti.context_for_each_variable(blk: block<(info:VarInfo):void>): auto

Iterates through all global variables in the given Context, yielding a VarInfo pointer for each registered variable.

Arguments:
  • blk : block<(info: VarInfo):void>

rtti.get_function_by_mnh(context: Context; MNH: uint64) : function<():void>

Returns a SimFunction pointer looked up by mangled name hash — an alternative form of get_function_address.

Arguments:
  • context : Context implicit

  • MNH : uint64

10.1.9.1. get_function_info

rtti.get_function_info(context: any; index: int): FuncInfo

Returns the FuncInfo pointer for a function at the given index in the Context, providing access to its name, arguments, and return type.

Arguments:
  • context : any

  • index : int

rtti.get_function_info(context: Context; function: function<():void>): FuncInfo const?

10.1.9.2. get_line_info

rtti.get_line_info(): LineInfo

Returns a LineInfo structure representing the source location (file, line, column) of the call site where get_line_info is invoked.

rtti.get_line_info(depth: int): LineInfo

rtti.get_total_functions(context: Context): int

Returns the total number of registered functions (int) in the given Context.

Arguments:
rtti.get_total_variables(context: Context): int

Returns the total number of global variables (int) in the given Context.

Arguments:
rtti.get_variable_info(context: any; index: int): VarInfo

Returns the VarInfo pointer for a global variable at the given index in the Context, providing access to its name, type, and offset.

Arguments:
  • context : any

  • index : int

rtti.get_variable_value(varInfo: VarInfo): RttiValue

Returns an RttiValue variant representing the current value of a global variable, looked up by VarInfo in the given Context.

Arguments:
rtti.this_context(): Context&

Returns a pointer to the current Context in which the calling code is executing.

10.1.9.3. type_info

rtti.type_info(cl: auto): TypeInfo const?

Returns the TypeInfo object for the specified local variable or expression, resolved at compile time via the [typeinfo(...)] macro.

Arguments:
  • cl : auto

rtti.type_info(vinfo: VarInfo): TypeInfo const?
rtti.type_info(vinfo: LocalVariableInfo): TypeInfo const?

10.1.10. Program access

rtti.get_module(name: string): Module?

Returns a Module pointer looked up by module name string, or null if no such module is registered.

Arguments:
  • name : string implicit

rtti.get_this_module(program: smart_ptr<Program>): Module?

Returns the Module pointer for the module currently being compiled or inferred, retrieved from the Program.

Arguments:
  • program : smart_ptr< Program> implicit

rtti.program_for_each_module(program: smart_ptr<Program>; block: block<(Module?):void>)

Iterates through all modules referenced by the given Program (including transitive dependencies), yielding a Module pointer for each.

Arguments:
  • program : smart_ptr< Program> implicit

  • block : block<( Module?):void> implicit

rtti.program_for_each_registered_module(block: block<(Module?):void>)

Iterates through all modules registered in the daslang runtime (globally, not per-program), yielding a Module pointer for each.

Arguments:
  • block : block<( Module?):void> implicit

10.1.11. Module access

rtti.module_for_each_annotation(module: Module?; block: block<(Annotation):void>)

Iterates through each annotation (handled type) in the given Module, yielding an Annotation pointer for each registered annotation.

Arguments:
rtti.module_for_each_dependency(module: Module?; block: block<(Module?;bool):void>)

Iterates through each module dependency of the given Module, yielding the dependent Module pointer for each required module.

Arguments:
  • module : Module? implicit

  • block : block<( Module?;bool):void> implicit

rtti.module_for_each_enumeration(module: Module?; block: block<(EnumInfo):void>)

Iterates through each enumeration declared in the given Module, yielding an EnumInfo pointer for each enum.

Arguments:
rtti.module_for_each_function(module: Module?; block: block<(FuncInfo):void>)

Iterates through each function declared in the given Module, yielding a FuncInfo pointer for each function.

Arguments:
rtti.module_for_each_generic(module: Module?; block: block<(FuncInfo):void>)

Iterates through each generic (template) function declared in the given Module, yielding a FuncInfo pointer for each generic.

Arguments:
rtti.module_for_each_global(module: Module?; block: block<(VarInfo):void>)

Iterates through each global variable declared in the given Module, yielding a VarInfo pointer for each variable.

Arguments:
  • module : Module? implicit

  • block : block<( VarInfo):void> implicit

rtti.module_for_each_structure(module: Module?; block: block<(StructInfo):void>)

Iterates through each structure declaration in the given Module, yielding a StructInfo pointer for each struct.

Arguments:

10.1.12. Annotation access

rtti.add_annotation_argument(annotation: AnnotationArgumentList; name: string): int

Appends an annotation argument (name-value pair) to the given AnnotationArgumentList, used when constructing annotations programmatically.

Arguments:
rtti.get_annotation_argument_value(info: AnnotationArgument): RttiValue

Returns an RttiValue variant representing the value of a specific named argument from an AnnotationArgumentList.

Arguments:

10.1.13. Compilation and simulation

10.1.13.1. compile

rtti.compile(module_name: string; codeText: string; codeOfPolicies: CodeOfPolicies; exportAll: bool; block: block<(bool;smart_ptr<Program>;das_string):void>)

Compiles a daslang program from a source code string using the provided FileAccess and ModuleGroup, returning a ProgramPtr (null on failure).

Arguments:
  • module_name : string implicit

  • codeText : string implicit

  • codeOfPolicies : CodeOfPolicies implicit

  • exportAll : bool

  • block : block<(bool;smart_ptr< Program>; das_string):void> implicit

rtti.compile(module_name: string; codeText: string; codeOfPolicies: CodeOfPolicies; block: block<(bool;smart_ptr<Program>;das_string):void>)

rtti.compile_file(module_name: string; fileAccess: smart_ptr<FileAccess>; moduleGroup: ModuleGroup?; codeOfPolicies: CodeOfPolicies; block: block<(bool;smart_ptr<Program>;das_string):void>)

Compiles a daslang program from a file registered in the given FileAccess object, returning a ProgramPtr (null on failure).

Arguments:
rtti.for_each_expected_error(program: smart_ptr<Program>; block: block<(CompilationError;int):void>)

Iterates through each expected compilation error declared in the Program (via expect), yielding the error code for each.

Arguments:
rtti.for_each_require_declaration(program: smart_ptr<Program>; block: block<(Module?;string#;string#;bool;LineInfo):void>)

Iterates through each require declaration of the compiled Program, yielding the module name, public/private flag, and source LineInfo.

Arguments:
  • program : smart_ptr< Program> implicit

  • block : block<( Module?;string#;string#;bool; LineInfo&):void> implicit

rtti.simulate(program: smart_ptr<Program> const&; block: block<(bool;smart_ptr<Context>;das_string):void>)

Simulates (links and initializes) a compiled Program, returning a Context pointer ready for function execution, or null on failure.

Arguments:

10.1.14. File access

rtti.add_file_access_root(access: smart_ptr<FileAccess>; mod: string; path: string): bool

Adds an extra root directory (search path) to the given FileAccess object, expanding where require resolves files from.

Arguments:
  • access : smart_ptr< FileAccess> implicit

  • mod : string implicit

  • path : string implicit

rtti.make_file_access(project: string): smart_ptr<FileAccess>

Creates and returns a new FileAccessPtr (smart_ptr<FileAccess>) initialized as a default file-system-backed project.

Arguments:
  • project : string implicit

rtti.set_file_source(access: smart_ptr<FileAccess>; fileName: string; text: string): bool

Registers a source code string for the given file name inside the FileAccess object, allowing in-memory compilation without disk files.

Arguments:
  • access : smart_ptr< FileAccess> implicit

  • fileName : string implicit

  • text : string implicit

10.1.15. Structure access

rtti.basic_struct_for_each_field(annotation: BasicStructureAnnotation; block: block<(string;string;TypeInfo;uint):void>)

Iterates through each field of a BasicStructureAnnotation, yielding the field name, C++ name, TypeInfo, and byte offset for each field.

Arguments:
rtti.basic_struct_for_each_parent(annotation: BasicStructureAnnotation; block: block<(Annotation?):void>)

Iterates through each parent (base class) of a BasicStructureAnnotation, yielding the parent TypeInfo for each ancestor.

Arguments:
rtti.rtti_builtin_structure_for_each_annotation(struct: StructInfo; block: block<():void>)

Iterates through each annotation attached to a StructInfo, yielding the annotation name and its AnnotationArgumentList for each.

Arguments:
  • struct : StructInfo implicit

  • block : block<void> implicit

rtti.structure_for_each_annotation(st: StructInfo; subexpr: block<(ann:Annotation;args:AnnotationArguments):void>): auto

Iterates through each annotation attached to a StructInfo, yielding the annotation name and AnnotationArgumentList — an alias of rtti_builtin_structure_for_each_annotation.

Arguments:

10.1.16. Data walking and printing

10.1.16.1. describe

rtti.describe(lineinfo: LineInfo; fully: bool = false): string

Returns a human-readable string description of an RTTI object (TypeInfo, VarInfo, FuncInfo, etc.), useful for logging and debug output.

Arguments:
  • lineinfo : LineInfo implicit

  • fully : bool

rtti.describe(type: TypeInfo const?): string

rtti.get_mangled_name(type: TypeInfo const?): string

Returns the full mangled name string for the given FuncInfo, encoding its module, name, and argument types.

Arguments:

10.1.16.2. sprint_data

rtti.sprint_data(data: float4; type: TypeInfo const?; flags: bitfield): string

Returns a string representation of a value given its data pointer and TypeInfo, similar to debug or print but capturing output as a string.

Arguments:
  • data : float4

  • type : TypeInfo? implicit

  • flags : bitfield<>

rtti.sprint_data(data: void?; type: TypeInfo const?; flags: bitfield): string

10.1.17. Function and mangled name hash

rtti.get_function_address(MNH: uint64; at: Context): uint64

Returns a SimFunction pointer looked up by mangled name hash in the given Context, or null if not found.

Arguments:
  • MNH : uint64

  • at : Context implicit

10.1.17.1. get_function_by_mangled_name_hash

rtti.get_function_by_mangled_name_hash(src: uint64; context: Context) : function<():void>

Returns a function<> lambda value looked up by its mangled name hash in the given Context.

Arguments:
  • src : uint64

  • context : Context implicit

rtti.get_function_by_mangled_name_hash(src: uint64) : function<():void>

rtti.get_function_mangled_name_hash(src: function<():void>): uint64

Returns the uint64 mangled name hash for the given function<> value, which uniquely identifies the function in its Context.

Arguments:
  • src : function<void>

10.1.18. Context and mutex locking

rtti.lock_context(lock_context: Context; block: block<():void>)

Acquires a recursive lock on the given Context and executes a block, ensuring thread-safe access to context data within the scope.

Arguments:
  • lock_context : Context implicit

  • block : block<void> implicit

rtti.lock_mutex(mutex: recursive_mutex; block: block<():void>)

Acquires a recursive lock on the given recursive_mutex and executes a block, releasing the lock when the block exits.

Arguments:
rtti.lock_this_context(block: block<():void>)

Acquires a recursive lock on the current Context and executes a block, ensuring thread-safe access within the scope.

Arguments:
  • block : block<void> implicit

10.1.19. Runtime data access

rtti.get_table_key_index(table: void?; key: any; baseType: Type; valueTypeSize: int): int

Returns the internal slot index (int) for the given key within a table value, or -1 if the key is not present.

Arguments:
  • table : void? implicit

  • key : any

  • baseType : Type

  • valueTypeSize : int

10.1.20. Tuple and variant access

rtti.get_tuple_field_offset(type: TypeInfo?; index: int): int

Returns the byte offset (int) of a field at the given index within a tuple type described by TypeInfo.

Arguments:
rtti.get_variant_field_offset(type: TypeInfo?; index: int): int

Returns the byte offset (int) of a field at the given index within a variant type described by TypeInfo.

Arguments:

10.1.21. Iteration

10.1.21.1. each

rtti.each(info: FuncInfo const implicit ==const): iterator<VarInfo const&>

Iterates through each element of an RTTI container (e.g., AnnotationArguments, AnnotationArgumentList, AnnotationList), yielding individual entries.

Arguments:
rtti.each(info: FuncInfo implicit ==const): iterator<VarInfo&>
rtti.each(info: StructInfo const implicit ==const): iterator<VarInfo const&>
rtti.each(info: StructInfo implicit ==const): iterator<VarInfo&>
rtti.each(info: EnumInfo const implicit ==const): iterator<EnumValueInfo const&>
rtti.each(info: EnumInfo implicit ==const): iterator<EnumValueInfo&>