host

API Reference

Effects

effect 'panic(message: String) -> Never

Aborts the current handled extent with a diagnostic message.

effect 'spawn(task: Task) -> ()

Adds task to the nearest cooperative scheduler scope.

Functions

func _io_host(request: IORequest) -> Int

The host adapter, in source: one arm per request case, each a fixed entry in the runtime's io operation table. Exhaustiveness keeps this dispatcher and the request enum in lockstep — adding a case forces an arm here.

func _run_cooperative(consume root_task: Task) -> ()

Runs one scheduler root and its complete spawned task tree on this worker.

func _block_wait(reasons: [WaitReason]) -> ()

The blocking wait fallback's body, shared with cooperative package schedulers that install their own root fallbacks: register every reason, block the worker, unregister, and return. Element access stays on the Optional-returning accessor: the trapping get would make 'panic reachable from this always-installed fallback and keep the panic host alive in programs that cannot panic.

func _with_host(consume body: Task) -> ()

The executable's host fallbacks (ADR 0039): ordinary handlers below every user handler, installed around the whole program by the entry wrapper. Which effects are ambient at the top level is exactly the row this callback declares — the compiler reads it from this signature rather than naming any effect itself. Resumable fallbacks continue; panic is the abortive process-termination fallback. Deliberately NOT delegated to _with_host_value through an adapter closure: a closure captures its effect capabilities at CREATION, and any adapter made here would capture before these fallbacks exist. The handler set is duplicated below instead.

func _with_blocking_host(consume body: BlockingTask) -> ()

The no-cooperative-effects entry specialization. The backend selects this wrapper only after proving that the reachable entry performs none of the effects admitted by Task but not BlockingTask. Keeping the scheduler unreachable preserves direct blocking park calls and avoids resumable C frames for blocking-only programs.