2.32. Options
The options statement sets compilation options for the current file. Options control
compiler behavior — linting, optimization, logging, memory limits, and language features.
Syntax:
options name = value
options name // shorthand for name = true
options a = true, b = false // multiple options, comma-separated
Option values can be bool, int, or string, depending on the option.
Multiple options statements are allowed per file. They can appear before or after
module and require declarations. By convention they are placed at the top of the file:
options gen2
options no_unused_block_arguments = false
module my_module shared public
require daslib/strings_boost
Note
The host application can restrict which options are allowed in which files via the
isOptionAllowed method on the project’s file access object.
2.32.1. Language and Syntax
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
false |
Enables generation-2 syntax. Requires |
|
int |
0 |
Tab size for indentation-sensitive parsing. Valid values are |
|
bool |
false |
Always exports initializer functions. |
|
bool |
true |
Enables constant folding during type inference. |
|
bool |
false |
Disables compile-time execution (the |
2.32.2. Lint Control
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
true |
Enables or disables all lint checks for this module. |
|
bool |
true |
Disallows writing to nameless (intermediate) variables on the stack. |
|
bool |
false |
Requires |
|
bool |
false |
Reports unused function arguments as errors. |
|
bool |
false |
Reports unused block arguments as errors. |
|
bool |
false |
Reports use of deprecated features as errors. |
|
bool |
false |
Reports aliasing as errors. When |
|
bool |
true |
Enables stricter safety checks for smart pointers. |
|
bool |
false |
Enables strict property semantics. When |
|
bool |
true |
Reports functions that are not visible from the current module. |
|
bool |
true |
Reports functions that are inaccessible due to private module visibility. |
2.32.3. Optimization
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
true |
Enables compiler optimizations. |
|
bool |
false |
Disables compiler optimizations (inverse of |
|
bool |
false |
Disables all optimizations unconditionally. Overrides all other optimization settings. |
|
bool |
true |
Enables simulation node fusion for faster execution. |
|
bool |
true |
Removes unused symbols from the compiled program. Must be |
|
bool |
false |
Disables the fastcall optimization. |
2.32.4. Memory
Option |
Type |
Default |
Description |
|---|---|---|---|
|
int |
16384 |
Stack size in bytes. Set to |
|
int |
65536 |
Initial heap size hint in bytes. |
|
int |
65536 |
Initial string heap size hint in bytes. |
|
int |
0 |
Maximum heap allocation in bytes. |
|
int |
0 |
Maximum string heap allocation in bytes. |
|
bool |
false |
Uses a persistent (non-releasing) heap. Old allocations are never freed — useful with garbage collection. |
|
bool |
false |
Enables garbage collection for the context. |
|
bool |
false |
Enables string interning lookup for the regular string heap. |
|
bool |
false |
Context does not release old memory from array or table growth (leaves it to the GC). |
2.32.5. AOT
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
false |
Disables AOT (ahead-of-time) compilation for this module. |
|
bool |
false |
Generates AOT prologue code (enables AOT export even when not strictly required). |
|
bool |
false |
Compiles module in AOT library mode. |
|
bool |
false |
Generates a standalone context class in AOT mode. |
|
bool |
false |
Only allows fast AOT functions. |
|
bool |
false |
Orders AOT side effects for deterministic evaluation. |
2.32.6. Safety and Strictness
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
false |
Disallows |
|
bool |
false |
Disallows module-level global variables (shared variables are still allowed). |
|
bool |
false |
Disallows all global variables, including shared ones. |
|
bool |
false |
Disallows global heap allocation. |
|
bool |
true |
Disallows |
|
bool |
true |
Makes table lookup ( |
|
bool |
false |
Relaxes const correctness on pointers. |
|
bool |
true |
Allows the |
|
bool |
false |
Makes |
|
bool |
true |
Struct and class members cannot be class types. |
|
bool |
false |
Skips all lock safety checks at runtime. |
|
bool |
false |
Skips lock checks for this module specifically. |
2.32.7. Multiple Contexts
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
false |
Indicates that the code supports multiple context safety. |
|
bool |
false |
All variable and function lookup is context-dependent (via index). Slightly faster, but prohibits AOT and patches. |
2.32.8. Debugging and Profiling
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
false |
Enables debugger support. Disables fastcall and adds a context mutex. |
|
bool |
false |
Enables profiler support. Disables fastcall. |
|
bool |
false |
Enables debugging of macro “not_inferred” issues. |
|
bool |
false |
Adds a mutex to the context for thread-safe access. |
|
bool |
false |
Prints compile time at the end of compilation. |
|
bool |
false |
Prints detailed compile time breakdown at the end of compilation. |
2.32.9. RTTI
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
false |
Creates extended RTTI (runtime type information). Required for reflection, |
2.32.10. Logging
The following options control diagnostic output during compilation. All are bool type,
default false.
Option |
Description |
|---|---|
|
Logs the program AST after compilation. |
|
Logs each optimization pass. |
|
Logs optimization results. |
|
Logs stack allocation. |
|
Logs initialization. |
|
Logs symbol usage information. |
|
Logs variable scoping. |
|
Logs simulation nodes. |
|
Logs AOT hash values for simulation nodes. |
|
Logs memory usage after simulation. |
|
Logs debug memory information. |
|
Logs C++ representation. |
|
Logs AOT output. |
|
Logs type inference passes. |
|
Logs module resolution. |
|
Logs generic function instantiation. |
|
Logs mangled name hashes. |
|
Logs global mangled name hashes. |
|
Logs annotation data hashes. |
|
Logs aliasing analysis. |
|
Logs inscope analysis for POD-like types. |
2.32.11. Print Control
The following options affect how the AST is printed (for log output). All are bool type,
default false.
Option |
Description |
|---|---|
|
Prints reference information in AST output. |
|
Prints variable access flags in AST output. |
|
Uses C-style formatting for AST output. |
|
Prints symbol usage flags. |
2.32.12. Miscellaneous
Option |
Type |
Default |
Description |
|---|---|---|---|
|
int |
50 |
Maximum number of type inference passes before the compiler gives up. |
|
bool |
true |
Reuses stack memory after variables go out of scope. |
|
bool |
false |
Forces inscope lifetime semantics for POD-like types. |
|
bool |
false |
Produces keep-alive nodes in simulation. |
|
bool |
true |
Serializes the main module instead of recompiling it each time. |
2.32.13. Module-Registered Options
Any module can register custom options via its getOptionType method.
These are validated during lint alongside the built-in options.
If a module defines its own option, any file that requires that module can use it.
If you set an option that is not recognized by either the built-in list, the policy list, or any loaded module, the compiler reports:
invalid option 'unknown_name'
If the option exists but you provide the wrong value type, the compiler reports:
invalid option type for 'name', unexpected 'float', expecting 'bool'
See also
Contexts for memory and stack allocation options,
Annotations for annotation-based equivalents,
Locks for skip_lock_checks option,
Unsafe for unsafe_table_lookup option,
Program structure for overall file layout and options placement.