Daslang 0.6 Reference Manual
Copyright (c) 2018-2026 Gaijin Entertainment
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- 1. Introduction
- 2. The language
- 2.1. Program Structure
- 2.2. Lexical Structure
- 2.3. Values and Data Types
- 2.3.1. Integer
- 2.3.2. Float
- 2.3.3. Bool
- 2.3.4. String
- 2.3.5. Type Conversion and Casting
- 2.3.6. Table
- 2.3.7. Array
- 2.3.8. Struct
- 2.3.9. Classes
- 2.3.10. Variant
- 2.3.11. Tuple
- 2.3.12. Enumeration
- 2.3.13. Bitfield
- 2.3.14. Function
- 2.3.15. Reference
- 2.3.16. Pointers
- 2.3.17. Smart Pointers
- 2.3.18. Iterators
- 2.4. Pointers
- 2.5. Constants, Enumerations, Global variables
- 2.6. Statements
- 2.6.1. Visibility Block
- 2.6.2. Control Flow Statements
- 2.6.3. Ranged Loops
- 2.6.4. break
- 2.6.5. continue
- 2.6.6. return
- 2.6.7. yield
- 2.6.8. pass
- 2.6.9. finally
- 2.6.10. Local Variable Declarations
- 2.6.11. assume
- 2.6.12. with
- 2.6.13. delete
- 2.6.14. Function Declaration
- 2.6.15. try/recover
- 2.6.16. panic
- 2.6.17. label and goto
- 2.6.18. Expression Statement
- 2.6.19. Global Variables
- 2.6.20. enum
- 2.6.21. typedef
- 2.7. Expressions
- 2.8. Function
- 2.8.1. Function declaration
- 2.8.2. OOP-style calls
- 2.8.3. Tail Recursion
- 2.8.4. Operator Overloading
- 2.8.5. Overloadable operators
- 2.8.6. Unary operators
- 2.8.7. Compound assignment operators
- 2.8.8. Index operators
- 2.8.9. Clone and finalize operators
- 2.8.10. is, as, and ?as operators
- 2.8.11. Null-coalesce operator
- 2.8.12. Struct method operators
- 2.8.13. Overloading the ‘.’ and ‘?.’ operators
- 2.8.14. Overloading accessors
- 2.9. Block
- 2.10. Lambda
- 2.11. Generator
- 2.12. Struct
- 2.13. Class
- 2.13.1. Member Visibility
- 2.13.2. Initializers
- 2.13.3. Calling Parent Methods
- 2.13.4. Runtime Type Checking (is)
- 2.13.5. Type Casting (as, ?as)
- 2.13.6. Class Templates
- 2.13.7. Static methods with
[class_method] - 2.13.8. Stack-Allocated Classes (using)
- 2.13.9. Complete Example
- 2.13.10. Implementation details
- 2.14. Tuple
- 2.15. Variant
- 2.16. Bitfield
- 2.17. Type Aliases
- 2.18. Array
- 2.19. Table
- 2.20. Iterator
- 2.21. Comprehension
- 2.22. String Builder
- 2.23. Modules
- 2.24. Move, Copy, and Clone
- 2.25. Clone
- 2.26. Finalizer
- 2.27. Temporary types
- 2.28. Unsafe
- 2.29. Generic Programming
- 2.30. Pattern matching
- 2.30.1. Enumeration Matching
- 2.30.2. Matching Variants
- 2.30.3. Declaring Variables in Patterns
- 2.30.4. Matching Structs
- 2.30.5. Using Guards
- 2.30.6. Tuple Matching
- 2.30.7. Matching Static Arrays
- 2.30.8. Dynamic Array Matching
- 2.30.9. Match Expressions
- 2.30.10. Matching with
|| - 2.30.11. [match_as_is] Structure Annotation
- 2.30.12. [match_copy] Structure Annotation
- 2.30.13. Static Matching
- 2.30.14. match_type
- 2.30.15. Multi-Match
- 2.31. Annotations
- 2.32. Options
- 2.33. Macros
- 2.33.1. Compilation passes
- 2.33.2. Invoking macros
- 2.33.3. AstFunctionAnnotation
- 2.33.4. AstBlockAnnotation
- 2.33.5. AstStructureAnnotation
- 2.33.6. AstEnumerationAnnotation
- 2.33.7. AstVariantMacro
- 2.33.8. AstReaderMacro
- 2.33.9. AstCallMacro
- 2.33.10. AstPassMacro
- 2.33.11. AstTypeMacro
- 2.33.12. AstTypeInfoMacro
- 2.33.13. AstForLoopMacro
- 2.33.14. AstCaptureMacro
- 2.33.15. AstCommentReader
- 2.33.16. AstSimulateMacro
- 2.33.17. AstVisitor
- 2.34. Reification
- 2.35. Built-in Functions
- 2.35.1. Invocation
- 2.35.2. Assertions
- 2.35.3. Debug
- 2.35.4. Panic
- 2.35.5. Memory & Type Utilities
- 2.35.6. Array Operations
- 2.35.7. Table Operations
- 2.35.8. Iterator Operations
- 2.35.9. Conversion Functions
- 2.35.10. Clone
- 2.35.11. Lock Operations
- 2.35.12. Serialization
- 2.35.13. Smart Pointer
- 2.35.14. Memory Mapping
- 2.35.15. Vector Construction
- 2.35.16. Move Helpers
- 2.35.17. Miscellaneous
- 3. The Runtime
- 3.1. Context
- 3.2. Locks
- 3.3. Type Mangling
- 3.3.1. Primitive types
- 3.3.2. Qualifiers and modifiers
- 3.3.3. Pointers
- 3.3.4. Composite prefixes
- 3.3.5. Container types
- 3.3.6. Fixed-size arrays (dim)
- 3.3.7. Callable types
- 3.3.8. Structures, handled types, and enumerations
- 3.3.9. Type aliases
- 3.3.10. Named arguments
- 3.3.11. Bitfields
- 3.3.12. Special / internal types
- 3.3.13. Remove-qualifiers (generics)
- 3.3.14. Interop function signatures
- 3.3.15. Querying mangled names at runtime
- 4. Embedding and Integration
- 4.1. Quick Start
- 4.2. C++ API Reference
- 4.3. C API Reference
- 4.3.1. When to use the C API
- 4.3.2. Initialization and shutdown
- 4.3.3. Text output
- 4.3.4. File access
- 4.3.5. Compilation
- 4.3.6. Simulation and context
- 4.3.7. Function evaluation
- 4.3.8. Argument helpers
- 4.3.9. Calling lambdas and blocks
- 4.3.10. Binding C functions
- 4.3.11. Binding types
- 4.3.12. String allocation
- 4.3.13. Context variables
- 4.3.14. Serialization
- 4.3.15. AOT checking
- 4.3.16. Module groups
- 4.3.17. Side effects
- 4.4. Advanced Topics