Structured Concurrency

seed uses structured spawn, ordinary typed task/synchronization libraries, and an M:N hosted runtime. It has no async/await or colored functions.

Spawn

fn compute(value: i64) {
    spawn {
        let answer = value + 1
    }
}

The compiler outlines the body into an internal worker and creates a concrete copy/move capture environment. Every edge leaving the owning lexical scope waits for its task group before cleanup, so a task cannot accidentally outlive captured stack/region state.

Captures require send; shared concurrent access additionally requires sync. Keeping the original while sending a resource requires an explicit clone. Mutable global state cannot be captured, directly or through a helper. Postfix ? cannot cross the task boundary while task bodies return void.

Task library

compiler/llvm/libs/task is an ordinary generic package. It provides:

Import/source-elide that package before using these types. The language itself does not define chan<t>, send, recv, rendezvous channels, detached spawn, or spawn for syntax.

Scheduler

Linux-native x86-64/AArch64 provide libc-free structured schedulers. Blocking task-library operations park through the runtime contract instead of pinning a worker. Task records carry active allocator context; region-bound work joins before region release.

Windows x86-64 uses CreateThread with lexical group joins and task-library channel/join execution, covered by required Wine execution. The macOS x86-64 and arm64 runtime/link surfaces use pthread scheduling; native Intel x86-64 execution remains the Gate 14 closure item, while arm64 is explicitly cross-link-only.

Typed task results

task_result_new<t, e>(), task_result_complete_ok/error, and task_result_wait specialize the linear one-shot endpoints over result<t,e>. Success and failure compose without async/await; the handle remains move-only, blocking is explicit, captures still require send, and region-backed handles cannot escape their region. This is a library surface, so spawn remains small and task costs stay visible.