Structured lock release
lock uses the same structured-finally transfer stack as exceptions and deterministic disposal, so monitor release is not skipped by normal fallthrough, return, break, continue, or managed exceptions.
VOID Language lifetime & abstractions
VOID treats cleanup and suspension as compiler-visible lifetime concerns. IDisposable, IAsyncDisposable, using, await using, iterator cleanup, ref-like escape rules, exceptions, and finally all share the same underlying control-flow and lifetime model.
Completed lifetime & abstraction foundation
Deterministic disposal, iterator cleanup, generalized awaiting, structured await using, ref-like escape checks, managed Memory, scoped pins, and native ownership all remain visible to the compiler. Asynchronous disposal now participates in the same structured cleanup graph as synchronous using instead of introducing a separate cleanup state machine.
lock releaselock uses the same structured-finally transfer stack as exceptions and deterministic disposal, so monitor release is not skipped by normal fallthrough, return, break, continue, or managed exceptions.
IDisposable & iterator disposalVoid.IDisposable is part of the root library contract. Collection enumerators and compiler-generated iterators can dispose deterministically, including pending iterator cleanup.
Non-array foreach disposes its enumerator on normal completion, early break, return, and exception paths through structured cleanup.
C#-style using (...) works with disposable reference and value types, null resources, nesting, exceptions, and normal GC behavior.
using var and typed using declarations dispose resources at scope exit in reverse declaration order across normal and exceptional exits.
await usingIAsyncDisposable provides the asynchronous cleanup contract, and await using resolves DisposeAsync() structurally through the generalized awaiter mechanism. Normal exit, early structured exits, faults, nested resources, and mixed synchronous/asynchronous cleanup stay inside the existing state-machine and LIFO cleanup model.
await foreach and compiler-generated async iterators retain their enumerator and producer state across suspension, then dispose asynchronously on normal completion, early exit, faults, cancellation, or consumer teardown.
CancellationTokenSource deterministically owns external, linked-parent, and timer registrations. Disposal unregisters those relationships so delayed cancellation and linked sources do not keep parent sources, callbacks, or timer state rooted after their lifetime ends.
Generic calls can omit explicit type arguments when VOID can infer them through the existing overload resolver and monomorphizer, including constrained and by-reference cases where inference is well-defined.
Static methods with a this first parameter can participate in instance-style call syntax while preserving ordinary instance-member precedence and normal overload resolution.
Interfaces can require static methods as compile-time contracts, implemented by ordinary public static methods on concrete classes or structs without interface-owned static storage.
Generic code constrained by an interface can call required static members through the type parameter; monomorphization lowers the call to the concrete static implementation.
Interface methods may provide bodies. Concrete implementations take precedence, inherited defaults provide fallback behavior, and ambiguous inherited defaults are diagnosed.
Span<T> and other ref-like values stay constrained by escape, capture, and suspension rules. Memory<T>/ReadOnlyMemory<T> are heap-storable managed array-backed values that retain their owner across async methods, iterators, Tasks, continuations, ThreadPool work, and GC without implying thread safety.
fixed acquires a runtime pin, keeps the managed owner rooted, and releases the pin through the same structured cleanup machinery used by normal control flow and exceptions. The fixed pointer is scoped and cannot be captured or returned as though the managed backing were permanently pinned.
NativeMemory allocations live outside the managed GC. Allocation, reallocation, alignment, and free are deliberately unsafe ownership operations, while Span views over that storage remain non-owning. VOID does not make unmanaged heap lifetime look managed when no managed owner exists.
Ordinary string values are GC-managed references, while native text ownership remains a boundary contract. Borrowed pointers expire according to their declared lifetime, owned native returns are released exactly once after conversion, retained native pointers require explicit representation, and exported strings never expose the GC object layout as a public C ABI.
One lifetime model
Structured exits, rethrow, GC-safe unwinding, iterator cleanup, await using, generalized await suspension, cancellation/timer registration cleanup, ref-like escape checks, and fixed pin release all feed compiler-visible lifetime rules. Heap-storable Memory and ValueTask state can cross legal suspension points because their managed references remain rooted; Span and fixed pointers cannot silently acquire that longer lifetime, CancellationTokenSource disposal tears down owned registrations, and NativeMemory remains manually owned outside the GC.
public sealed class GameFile : IDisposable
{
public void Dispose()
{
Console.WriteLine("closed");
}
}
using (GameFile file = new GameFile())
{
Run(file);
}public static T Identity<T>(T value)
{
return value;
}
public static int Twice(this int value)
{
return value * 2;
}
int value = Identity(21);
Console.WriteLine(value.Twice() == 42);public sealed class AsyncResource : IAsyncDisposable
{
public async Task DisposeAsync()
{
await Task.Yield();
Console.WriteLine("closed");
}
}
public static async Task RunAsync()
{
await using var resource = new AsyncResource();
await UseAsync(resource);
}public interface IFactory<T>
{
static T Create();
string Name()
{
return "default";
}
}
public static T Build<T, TFactory>()
where TFactory : IFactory<T>
{
return TFactory.Create();
}Iterator lifetime
Pattern locals and managed intermediate values that survive yield are promoted into normal iterator state-machine storage, remain rooted through suspension and forced GC, and participate in disposal, exception, finally, and teardown cleanup without a parallel capture system.