Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

Initializable

Defines the canonical variadic runtime-initialization requirement.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.prelude

import std.prelude;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

Initializable

pub concept Initializable<Self, each A>

Defines the canonical variadic runtime-initialization requirement.

Satisfaction is structural and compile-time-only. The ordered argument pack selects one ordinary initializer and creates no runtime witness, allocation, or source-visible constructor object.

Self: Concrete value type whose initializer is required. A: Ordered final pack of initializer argument types and access modes.

Example

module example.initializable;
from std.prelude import Initializable;
pub struct Counter {
    pub Value: i32;
    pub init(Value: i32) { this.Value = Value; }
}
fn Create<T>(Value: i32) -> T
    where T: Initializable<i32>
{
    return T(Value);
}
fn Main() -> i32 {
    let Value = Create<Counter>(42);
    return Value.Value - 42;
}

Initializable.requirement

requires init(each Argument: A);

Requires one initializer applicable to the complete ordered pack.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library