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

Async & concurrency

Explicit tasks and visible lifetimes.

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

The direction

Sn's accepted concurrency scope includes async/await and a native standard-library foundation for nonblocking use. This work preserves explicit ownership, observable allocation, and recoverable failure.

Task APIs

The standard library provides task carriers, cancellation and synchronization APIs. Their contracts describe when work starts, what is owned or borrowed, and when completion releases storage.

Lifetimes cross suspension

A borrowed argument must remain valid for the complete operation, including worker execution and suspension. Read each API's documented loan and cancellation behavior.

Cancellation is not forced interruption

A native blocking call may not be interruptible after it starts. An asynchronous wrapper can wait for that call before discarding results or releasing storage.

Validation remains ongoing

Concurrency source and focused Shipping evidence exist, while complete sanitizer and strict validation remain incomplete. This page does not claim production readiness or race freedom.

Example: await a native timer

module example.delay;
from std.task import Task, DelayAsync;
from std.time import Milliseconds;
async fn Main() -> Task<i32> {
    switch await DelayAsync(Milliseconds.Create(0)) {
        case .Ok => {}
        case .Err { Error = _ } => return 1;
    }
    switch await DelayAsync(Milliseconds.Create(-1)) {
        case .Ok => return 2;
        case .Err { Error = _ } => {}
    }
    switch await DelayAsync(Milliseconds.Create(1)) {
        case .Ok => return 0;
        case .Err { Error = _ } => return 3;
    }
}

This is the standard library’s maintained delay workflow. It covers immediate completion, a rejected negative duration, and a positive wait. The task returns a typed result, so failure remains visible in ordinary control flow. A pending timer wait does not require blocking a worker for the duration. See [DelayAsync](/reference/dev/std-task-delay/) for cancellation and scheduling contracts.

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