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

UnaryCallable

Defines one safe readonly invocation with exact input and result types.

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.iteration

import std.iteration;

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

UnaryCallable

pub concept UnaryCallable<Self, T, R>

Defines one safe readonly invocation with exact input and result types.

Satisfaction is structural. Compiler-generated capturing lambdas use their existing method through an authenticated canonical witness; authored objects provide a public readonly Invoke. The concept introduces no dynamic box, allocation or runtime witness table. Capture ownership remains the concrete callable's contract; borrowed captures must outlive every invocation. Self: Concrete callback/environment type. T: Exact input type and reference access. R: Exact output type and reference access. Warning: Safety and calling convention remain exact; unsafe callbacks cannot erase authorization.

UnaryCallable.Invoke

requires readonly fn Invoke(Item: T) -> R;

Invokes the exact safe unary callback through readonly environment access. Item: Exact input; owning values transfer and references remain aliases. Return: Exact output; any borrowed result retains the callback's backing restrictions.

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