VOID Language value types & control flow

Value types that compose.
Control flow that holds up.

VOID keeps value semantics predictable even when structs become part of larger managed systems. Nested and readonly values can move through arrays, closures, iterators, nullable storage, and GC-traced layouts without turning into special cases.

Completed value-type & control-flow foundation

Everyday game code without the old deferred walls.

Value types are easy in isolation; the difficult part is preserving copying, mutability, lifetime, and managed references when they pass through the rest of the language. VOID's integration work focuses on those crossings.

Nested value structs

Structs can contain other value structs normally. Layout, default values, copying, generics, arrays, nullable wrappers, static storage, and recursive GC tracing all understand nested value layouts.

Readonly structs

readonly struct, readonly instance methods/accessors, readonly fields, and calls through in parameters preserve value semantics without hidden mutation.

Jagged arrays

Recursive array-of-array types such as T[][] and deeper forms support allocation, initialization, nested indexing, foreach, generics, nullable inner arrays, and managed elements.

Rectangular arrays

Real multidimensional arrays support rank, dimensions, indexing, iteration, GC-aware elements, and nested typed initializer braces such as new int[,] { { 1, 2 }, { 3, 4 } } with inferred shape, row-major layout, conversions, and ragged-shape diagnostics.

Nested closures

Closures can live inside other closures, and foreach captures receive proper per-iteration frames so escaped delegates keep the value from the iteration that created them.

By-reference closure capture

Closures can capture ref, out, and in parameters. Delegate lambdas can use by-reference parameters, while struct instance methods can safely capture struct this.

Iterator completion

Iterator state machines preserve ordinary local inference, definite assignment, nested/sibling shadowing, managed roots, control flow across yield, foreach, switch, loops, and base-member access, plus exception propagation and finally cleanup across suspension/resume.

Unsafe pointer members

Unsafe types can expose pointer properties and constructors, including pointer ref/out/in parameters, without weakening the existing unsafe project/type boundaries.

Rectangular initializer completion

Rectangular arrays can combine explicit compile-time dimensions with nested values or infer their dimensions directly from new[,]-style initializers, while preserving rank/shape validation, conversions, evaluation order, and managed-element tracing.

Null-conditional arrays

?[] works across one-dimensional, jagged, and higher-rank rectangular arrays with nullable lifting, short-circuiting, chained element access, single evaluation, and skipped index expressions when the receiver is null.

Compound targets

Compound assignment works through indexers and writable vector swizzles while preserving single evaluation of receivers, indices, and right-hand sides.

GC-aware composition

Managed references remain traceable when buried inside nested value structs, arrays, closure frames, iterator state, nullable values, static roots, and combinations of those structures.

Integrated behavior

The hard part is the composition.

The compiler has to preserve value semantics even when a struct is nested, captured, suspended by an iterator, stored in arrays, or contains managed references. Those combinations are exercised together because that is where hidden copying and rooting mistakes tend to appear.