Closed PreviewCompiler source opens July 1, 2026. Playground and binary available today.Join Discord →
MetaScript
Concurrency

Concurrency

async, spawn, and lightweight tasks — the base primitives that compose with actors

MetaScript's base concurrency primitives — async and spawn — are language-level constructs that compose with actors.

async

Language-level async/await. Functions declared async return Promise<T>; await suspends the current coroutine without blocking the scheduler thread. On the C backend this lowers to state machines; on JS it maps to native promises.

spawn

Fork-join lightweight tasks. Start a unit of work on a separate executor thread and either await the result or detach.

Composition with actors

Actors are built on top of these primitives — an actor method runs on the scheduler, await spawn(...) inside an actor suspends the actor cooperatively. See the Actors page for the full actor programming model: isolated state, message passing, and supervision trees.