Runtime & Memory

Runtime and Memory Model

Current representations for values, collections, references, pointers, and function values.

Raz Gen2 Manual·Runtime & Memory

This page records what the current C++17 backend emits and separates it from language-level guarantees that have not yet been defined.

Feature Current implementation Open contract
Primitive values i64, f64, bool, char, string; void for function returns. Conversions, overflow, and numeric edge cases.
List<T> Emitted as std::vector<T>. Copying, mutation, invalid indexing, and any bounds guarantees.
Ref<T> Emitted as a C++ reference T&. Aliasing, lifetime, and return restrictions.
Raw pointer Only char* is currently accepted, inside unsafe. Pointer operations and the full safety boundary.
nullptr Recognized as a null-pointer literal. Valid assignment and comparison contexts.
new T() Constructs a typed value through the backend. Do not assume heap-allocation semantics; constructor arguments are restricted.
const Reassignment of the binding is rejected. Nested mutation and mutation through aliases.
Function values Fn(Args)->R signatures map to generated backend aliases. Closures, captures, and lifetime.
Object lifetime Primarily follows generated C++ value, reference, and container semantics. Raz-level lifetime and destruction guarantees are not comprehensive.
Core principle: C++ representation is not, by itself, the Raz contract. The manual must describe observable Raz behavior independently wherever portability and stable semantics are intended.

Design questions

  • Define whether a Raz value is copied, moved, or referenced in each context.
  • Set explicit rules for reference lifetime and returning references.
  • Specify integer overflow, division edge cases, and floating-point behavior.
  • Define what unsafe permits and which operations remain forbidden.