LEGACY DOCS · 12.0Stable is 13.2. This page stays because it still owns historical or unchanged contracts.CURRENT 13.2 →
RELEASE LINE13.2 STABLE13.1 PREDECESSOR13.0 PREVIOUS12.4 NATIVE MIRARCHIVE

V12.0 BASE CONTRACT

Generics

Bracket generics are checked symbolically and monomorphized deterministically.

DByte 12.0 · Language

Contract§

fn id[T](value: T) -> T:
    return value

pub fn kernel_main() -> int:
    let answer: u32 = id[u32](40 as u32) + (2 as u32)
    if answer != (42 as u32):
        return 1
    return 0

Source: source-examples/v12.0.0/generics.dby

generics.dbyDOWNLOADOPEN RAW
fn id[T](value: T) -> T:
    return value

pub fn kernel_main() -> int:
    let answer: u32 = id[u32](40 as u32) + (2 as u32)
    if answer != (42 as u32):
        return 1
    return 0
DBY · 186 BSHA-256 22d75c6420cedd882da86fa94c98a62552f05aa0407c79ca2ac145eae5539438

Mechanics§

Generic bodies are checked symbolically and specialization uses GenericDefId plus canonical TypeId arguments. Consumer modules own deterministic local specialization symbols, while same-instance recursion reuses its current specialization.

Validation and failure§

Inferred numeric, equality, ordering and Copy requirements are checked for every instance. Type-growing recursion fails with E_GENERIC_INSTANTIATION_RECURSION; open generic parameters may not reach a backend.

Evidence and boundary§

HIR inspection shows concrete instances and native object symbols expose deterministic __dbyte_mono specializations.

Executable example§

fn id[T](value: T) -> T:
    return value

pub fn kernel_main() -> int:
    let answer: u32 = id[u32](40 as u32) + (2 as u32)
    if answer != (42 as u32):
        return 1
    return 0

WEBSITE V12 FIXTURE