Stdlib module async/async.vitl

This page is a wiki-style reference for one concrete stdlib file. It explains what the file owns, where it fits in the family, and how to decide whether this is the right surface to depend on.

Visual portrait of async/async.vitl
Wiki-style portrait for async/async.vitl.

Family: async

Kind: public stdlib surface

Page style: this reference follows the same “encyclopedic card + portrait + usage contract” logic as the keyword pages, but for stdlib modules.

Summary

Overview

FieldValue
Pathasync/async.vitl
Familyasync
Kindpublic stdlib surface
Line count281
Declared procedures29
Declared forms/picks3

`async/async.vitl` is a public stdlib surface inside the `async` family. It should be read as one focused slice of the broader family responsibility: Future, channel, executor, and task orchestration helpers.

Purpose

This file should be chosen because of responsibility, not because its name “sounds close enough”. Inside the async family, it carries one focused part of the contract and keeps that responsibility separate from neighboring concerns.

  • Use this module when coordination and scheduling are explicit parts of the design.
  • A pipeline can spawn tasks, exchange messages through channels, and join through the executor boundary.

Taxonomy

Think of this page as a generated encyclopedia entry rather than a hand-written tutorial. The goal is to show what kind of module this is, how dense it is, and what reading strategy makes sense before depending on it.

  • Large algorithm surface: this file exposes many procedures and likely acts as a domain toolkit rather than a single thin wrapper.
  • Owns domain vocabulary: the module declares data shapes in addition to executable helpers, so its types are part of the contract.
  • Has tuning constants: part of the module behavior is controlled by named constants that document default precision, limits, or policy.
  • Narrow dependency fan-in: a small set of imports suggests a focused collaboration surface.
  • Explicit export surface: the file ends with visible export declarations instead of relying only on implicit namespace discovery.

Implementation profile

This profile is inferred directly from the source text. It does not replace reading the file, but it tells you quickly whether the module is mostly declarative, loop-heavy, branch-heavy, or organized around many small exits.

SignalCountWhat it suggests
if7Branching density and local decision-making.
while6Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let30Local state and intermediate value density.
give33Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Proceduresglobal_executor, async, await, try_await, spawn_task, join_all, async_sleep, init_executor, start_executor, stop_executor, executor_runtime_stats, create_channel
FormsTimeoutResult, BatchProcessor, TaskPool
Picksnone declared at top level
ConstantsGLOBAL_EXECUTOR
Exports*

Imported surfaces

  • vitte/stdlib/core use vitte/stdlib/async/future use vitte/stdlib/async/channel use vitte/stdlib/async/executor form TimeoutResult

Position in family

This file is module 1 of 4 in the async family when ordered by path. By procedure count it ranks 1, and by line count it ranks 1. Those ranks are useful as rough signals of breadth, not as quality judgments.

Declaration map

The declaration map turns raw source into a scan-friendly catalog. It is useful when the file is large enough that a reader wants to orient by kinds of surfaces first.

LineNameKindRole
1vitte/stdlib/asyncspaceDeclares the namespace that anchors this file in the stdlib tree.
3vitte/stdlib/coreuseImports a sibling or supporting surface used by the module.
4vitte/stdlib/async/futureuseImports a sibling or supporting surface used by the module.
5vitte/stdlib/async/channeluseImports a sibling or supporting surface used by the module.
6vitte/stdlib/async/executoruseImports a sibling or supporting surface used by the module.
8TimeoutResultformIntroduces a structured data shape that other procedures can exchange.
13BatchProcessorformIntroduces a structured data shape that other procedures can exchange.
20TaskPoolformIntroduces a structured data shape that other procedures can exchange.
27GLOBAL_EXECUTORconstDefines a named constant reused across the module.
37global_executorprocOwns coordination, scheduling, or concurrency behavior.
41asyncprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
50awaitprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
54try_awaitprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
65spawn_taskprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
70join_allprocOwns path semantics, traversal, or normalization.
92async_sleepprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
103init_executorprocOwns coordination, scheduling, or concurrency behavior.
114start_executorprocOwns coordination, scheduling, or concurrency behavior.
118stop_executorprocOwns coordination, scheduling, or concurrency behavior.
122executor_runtime_statsprocOwns coordination, scheduling, or concurrency behavior.
126create_channelprocOwns coordination, scheduling, or concurrency behavior.
130parallel_allprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
134race_firstprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
138with_timeoutprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
155timeout_has_valueprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
159timeout_valueprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
167retry_asyncprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
183batch_processor_newprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
193batch_addprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
203task_pool_newprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
220task_pool_submitprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
228task_pool_wait_allprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
233task_pool_shutdownprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
238sleep_msprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
242async_versionprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
246async_readyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
250async_selftest_valueprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
254async_selftestprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 38 matching surfaces.

Representative signatures

These signatures are shown in source order so the page keeps the feel of a reference manual, not just a keyword cloud.

  • form TimeoutResult<T> { (line 8)
  • form BatchProcessor<T, U> { (line 13)
  • form TaskPool { (line 20)
  • const GLOBAL_EXECUTOR: Executor = Executor { (line 27)
  • proc global_executor() -> Executor { (line 37)
  • proc async<T>(body: proc) -> Future<T> { (line 41)
  • proc await<T>(fut: Future<T>) -> T { (line 50)
  • proc try_await<T>(fut: Future<T>, timeout_ms: int) -> bool { (line 54)
  • proc spawn_task<T>(fut: Future<T>) -> int { (line 65)
  • proc join_all(task_ids: [int]) -> bool { (line 70)
  • proc async_sleep(ms: int) -> Future<bool> { (line 92)
  • proc init_executor(num_workers: int) -> bool { (line 103)
  • proc start_executor() -> int { (line 114)
  • proc stop_executor() -> int { (line 118)
  • proc executor_runtime_stats() -> ExecutorStats { (line 122)
  • proc create_channel<T>(capacity: int) -> Channel<T> { (line 126)
  • proc parallel_all<T>(futures: [Future<T>]) -> [T] { (line 130)
  • proc race_first<T>(futures: [Future<T>]) -> T { (line 134)

The list is intentionally capped here; the source file declares 33 matching signatures in total.

How to use this module

Start by reading the file as an ownership boundary. Ask three questions: what enters this module, what stable types or procedures it exports, and what adjacent module should stay outside of it.

  1. Read space and top-level imports first so the ownership boundary of async/async.vitl is explicit.
  2. Scan constants before procedures; they often encode precision, limits, or policy assumptions that explain later behavior.
  3. Read declared forms and picks before algorithms so the data vocabulary is stable in your head.
  4. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  5. Only after that compare neighbor modules, because the right boundary choice matters more than memorizing one helper name.

User example

This example is generated from the actual stdlib module surface. Its job is not to be the smallest snippet possible; its job is to show a realistic consumer-shaped file that exercises the module and mirrors the language keywords the module itself relies on.

space demo/async_async
use vitte/stdlib/async
const SAMPLE_LABEL: string = "demo"
form UserReport {
  label: string,
  ready: bool
}
proc run_example() -> UserReport {
  let entries = parallel_all([])
  let ready: bool = try_await(Future<T>(), 1)
  let failed: bool = false
  let stable: bool = ready and true
  let idx: int = 0
  let count: int = 0
  while idx < entries.len {
    set count = count + 1
    set idx = idx + 1
  }
  if not ready {
    give UserReport { label: "not-ready", ready: false }
  }
    give UserReport { label: "ok", ready: true }
}
export run_example

Keyword coverage

This table makes the “all keywords of the module” requirement auditable. It compares the detected Vitte keywords in the source file with the generated consumer example above.

KeywordPresent in module sourceUsed in generated user example
spaceyesyes
useyesyes
constyesyes
formyesyes
procyesyes
letyesyes
setyesyes
ifyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes
notyesyes

The generated snippet exercises every detected Vitte keyword used by this module.

Source shape

space vitte/stdlib/async
use vitte/stdlib/core
use vitte/stdlib/async/future
use vitte/stdlib/async/channel
use vitte/stdlib/async/executor
form TimeoutResult<T> {
  completed: bool,
  values: [T],
}
form BatchProcessor<T, U> {

The excerpt is not meant to replace the file. It exists to make the module recognizable at first glance, the same way a Wikipedia infobox helps the reader orient before reading the whole article.

Source landmarks

Large files are easier to retain when they have visible landmarks. When the source contains explicit section banners, they are surfaced here; otherwise the first major declarations are used as anchors.

  • Line 1: space vitte/stdlib/async
  • Line 3: use vitte/stdlib/core
  • Line 4: use vitte/stdlib/async/future
  • Line 5: use vitte/stdlib/async/channel
  • Line 6: use vitte/stdlib/async/executor
  • Line 8: form TimeoutResult<T> {
  • Line 13: form BatchProcessor<T, U> {
  • Line 20: form TaskPool {

Source organization

When a file carries its own internal chaptering, those chapters usually reveal the intended reading order better than a flat symbol list. This section reconstructs that organization from the source itself.

File surfaces

Top-level items: 39. Procedures: 29. Data surfaces: 3. Constants: 1.

First visible names: vitte/stdlib/async, vitte/stdlib/core, vitte/stdlib/async/future, vitte/stdlib/async/channel, vitte/stdlib/async/executor, TimeoutResult, BatchProcessor, TaskPool, GLOBAL_EXECUTOR, global_executor

Complete API catalog

This catalog is the exhaustive file-level index for the module. It is intentionally closer to a generated encyclopedia appendix than to a tutorial summary.

Constants

LineNameSignatureRole
27GLOBAL_EXECUTORconst GLOBAL_EXECUTOR: Executor = Executor {Defines a named constant reused across the module.

Data surfaces

LineNameSignatureRole
8TimeoutResultform TimeoutResult<T> {Introduces a structured data shape that other procedures can exchange.
13BatchProcessorform BatchProcessor<T, U> {Introduces a structured data shape that other procedures can exchange.
20TaskPoolform TaskPool {Introduces a structured data shape that other procedures can exchange.

Procedures

LineNameSignatureRole
37global_executorproc global_executor() -> Executor {Owns coordination, scheduling, or concurrency behavior.
41asyncproc async<T>(body: proc) -> Future<T> {Represents one top-level surface in the file contract and should be read as part of the module boundary.
50awaitproc await<T>(fut: Future<T>) -> T {Represents one top-level surface in the file contract and should be read as part of the module boundary.
54try_awaitproc try_await<T>(fut: Future<T>, timeout_ms: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
65spawn_taskproc spawn_task<T>(fut: Future<T>) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
70join_allproc join_all(task_ids: [int]) -> bool {Owns path semantics, traversal, or normalization.
92async_sleepproc async_sleep(ms: int) -> Future<bool> {Represents one top-level surface in the file contract and should be read as part of the module boundary.
103init_executorproc init_executor(num_workers: int) -> bool {Owns coordination, scheduling, or concurrency behavior.
114start_executorproc start_executor() -> int {Owns coordination, scheduling, or concurrency behavior.
118stop_executorproc stop_executor() -> int {Owns coordination, scheduling, or concurrency behavior.
122executor_runtime_statsproc executor_runtime_stats() -> ExecutorStats {Owns coordination, scheduling, or concurrency behavior.
126create_channelproc create_channel<T>(capacity: int) -> Channel<T> {Owns coordination, scheduling, or concurrency behavior.
130parallel_allproc parallel_all<T>(futures: [Future<T>]) -> [T] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
134race_firstproc race_first<T>(futures: [Future<T>]) -> T {Represents one top-level surface in the file contract and should be read as part of the module boundary.
138with_timeoutproc with_timeout<T>(fut: Future<T>, timeout_ms: int) -> TimeoutResult<T> {Represents one top-level surface in the file contract and should be read as part of the module boundary.
155timeout_has_valueproc timeout_has_value<T>(result: TimeoutResult<T>) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
159timeout_valueproc timeout_value<T>(result: TimeoutResult<T>) -> T {Represents one top-level surface in the file contract and should be read as part of the module boundary.
167retry_asyncproc retry_async<T>(operation_id: int, max_attempts: int, backoff_ms: int) -> Future<T> {Represents one top-level surface in the file contract and should be read as part of the module boundary.
183batch_processor_newproc batch_processor_new<T, U>(size: int, processor_id: int) -> BatchProcessor<T, U> {Represents one top-level surface in the file contract and should be read as part of the module boundary.
193batch_addproc batch_add<T, U>(bp: BatchProcessor<T, U>, item: T) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
203task_pool_newproc task_pool_new(num_workers: int) -> TaskPool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
220task_pool_submitproc task_pool_submit(pool: TaskPool, task_id: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
228task_pool_wait_allproc task_pool_wait_all(pool: TaskPool) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
233task_pool_shutdownproc task_pool_shutdown(pool: TaskPool) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
238sleep_msproc sleep_ms(ms: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
242async_versionproc async_version() -> string {Represents one top-level surface in the file contract and should be read as part of the module boundary.
246async_readyproc async_ready() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
250async_selftest_valueproc async_selftest_value() -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
254async_selftestproc async_selftest() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.

Imports

LineNameSignatureRole
3vitte/stdlib/coreuse vitte/stdlib/coreImports a sibling or supporting surface used by the module.
4vitte/stdlib/async/futureuse vitte/stdlib/async/futureImports a sibling or supporting surface used by the module.
5vitte/stdlib/async/channeluse vitte/stdlib/async/channelImports a sibling or supporting surface used by the module.
6vitte/stdlib/async/executoruse vitte/stdlib/async/executorImports a sibling or supporting surface used by the module.

Exports

LineNameSignatureRole
281*export *Re-exports surfaces that the module wants to expose as part of its public boundary.

Integration boundaries

Within async, this file should remain focused. If a future helper changes the host boundary, scheduling boundary, or data-shape boundary, it probably belongs in a neighbor module instead of being added here by convenience.

  • Family responsibility: Future, channel, executor, and task orchestration helpers.
  • Family architecture role: Use `async` when work should be coordinated as tasks rather than as direct thread ownership.

Composition guidance

Choose this module when

  • Choose async/async.vitl when the main question is owned by this module rather than by transport, storage, orchestration, or user-interface code.
  • Use this module when coordination and scheduling are explicit parts of the design.
  • A pipeline can spawn tasks, exchange messages through channels, and join through the executor boundary.

Pause before extending it when

  • Avoid extending this file when the new helper mostly changes the boundary to host I/O, runtime coordination, or foreign integration instead of staying inside async.
  • Check nearby modules such as async/channel.vitl, async/executor.vitl, async/future.vitl before adding convenience wrappers here.

Relationship table

This table keeps the page closer to a real encyclopedia entry: a module is easier to understand when compared with its nearest alternatives in the same family.

NeighborProceduresData surfacesWhy compare it
async/channel.vitl243Shares the same family boundary but carries a distinct slice of responsibility.
async/executor.vitl183Shares the same family boundary but carries a distinct slice of responsibility.
async/future.vitl241Shares the same family boundary but carries a distinct slice of responsibility.

Neighbor modules