VOID Language conversions

One conversion model.
Concrete code to constrained generics.

VOID now classifies, selects, and preserves conversions through one compiler-owned semantic model. Standard conversions, user-defined operators, nullable lifting, target typing, static-interface contracts, constrained generic dispatch, iterators, closures, and GC all share the same source of truth.

Completed conversion semantics

The compiler decides the conversion once.

Semantic analysis classifies the source and target types, selects the applicable standard or user-defined conversion, records why the conversion is legal, and hands that binding forward. Later lowering and code generation consume that decision instead of trying to rediscover it.

Standard conversions

Identity, numeric, enum, reference/interface, null, nullable, and existing pointer/unsafe conversions use one semantic classification vocabulary and ranking model.

User-defined conversions

implicit and explicit conversion operators participate in applicability, accessibility, ambiguity, and surrounding standard-conversion rules through the shared resolver.

Lifted nullable conversions

User-defined value conversions lift through nullable values with normal null propagation, legal explicit extraction, and focused ambiguity/invalid-conversion diagnostics.

Target-typed sites

Assignments, locals, fields, properties, parameters, returns, constructors, arrays, initializers, params, conditionals, and switch expressions all ask the same conversion engine.

Static interface contracts

Interfaces can require signature-only implicit or explicit conversions. Implementing types are validated through existing static-interface inheritance, conflict, accessibility, and specialization rules.

Constrained generic dispatch

Generic implicit or explicit conversions are legal only when the generic constraints authorize the required conversion. Monomorphization then resolves the already-proven operation to the concrete implementation.

Provenance & inference

Generic method inference, overload resolution, target typing, specialized fields/properties, and transformed expressions preserve the conversion contract that made the source code valid.

Iterator, closure & GC safety

Conversion provenance survives captured locals and iterator promotion across yield, forced GC, exceptions, finally, deterministic disposal, and managed conversion results.

Stable diagnostics

Ambiguous, inaccessible, unsupported, and unconstrained conversions are rejected at the semantic site with user-facing diagnostics rather than leaking lowering details.

Semantic authority

Concrete types do not retroactively legalize generic source.

A specialized type may happen to provide a conversion, but generic source can use that conversion only when its constraints prove it. VOID carries that proof through specialization, iterator/closure transformation, and lowering so code generation never widens the language after semantic analysis.

Concrete user-defined conversions
public struct Meters
{
    public int Value;

    public static implicit operator Meters(int value)
    {
        return new Meters { Value = value };
    }

    public static explicit operator int(Meters value)
    {
        return value.Value;
    }
}

Meters distance = 12;
int raw = (int)distance;
Static interface conversion contract
public interface IFromInt<T>
{
    static implicit operator T(int value);
}

public static T Convert<T>(int value)
    where T : IFromInt<T>
{
    return value;
}
Lifted nullable conversion
int? source = 12;
Meters? converted = source;

source = null;
converted = source; // remains empty