Stdlib module async/channel.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/channel.vitl
Wiki-style portrait for async/channel.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/channel.vitl
Familyasync
Kindpublic stdlib surface
Line count253
Declared procedures24
Declared forms/picks3

`async/channel.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.
  • 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
if9Branching density and local decision-making.
while4Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let24Local state and intermediate value density.
give27Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Procedureschannel_new, channel_send, channel_recv, channel_try_recv, channel_is_closed, channel_close_sender, channel_close_receiver, channel_len, channel_select, queue_new, queue_push, queue_pop
FormsQueue, Channel, Select
Picksnone declared at top level
Constantsnone declared at top level
Exports*

Imported surfaces

  • vitte/stdlib/core form Queue

Position in family

This file is module 2 of 4 in the async family when ordered by path. By procedure count it ranks 2, and by line count it ranks 3. 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/async/channelspaceDeclares the namespace that anchors this file in the stdlib tree.
3vitte/stdlib/coreuseImports a sibling or supporting surface used by the module.
5QueueformIntroduces a structured data shape that other procedures can exchange.
9ChannelformIntroduces a structured data shape that other procedures can exchange.
20SelectformIntroduces a structured data shape that other procedures can exchange.
25channel_newprocOwns coordination, scheduling, or concurrency behavior.
39channel_sendprocOwns coordination, scheduling, or concurrency behavior.
60channel_recvprocOwns coordination, scheduling, or concurrency behavior.
79channel_try_recvprocOwns coordination, scheduling, or concurrency behavior.
95channel_is_closedprocOwns coordination, scheduling, or concurrency behavior.
99channel_close_senderprocOwns coordination, scheduling, or concurrency behavior.
112channel_close_receiverprocOwns coordination, scheduling, or concurrency behavior.
124channel_lenprocOwns coordination, scheduling, or concurrency behavior.
131channel_selectprocOwns coordination, scheduling, or concurrency behavior.
153queue_newprocOwns a concrete data shape or the operations that maintain it.
160queue_pushprocOwns a concrete data shape or the operations that maintain it.
165queue_popprocOwns a concrete data shape or the operations that maintain it.
177queue_lenprocOwns a concrete data shape or the operations that maintain it.
181queue_restprocOwns a concrete data shape or the operations that maintain it.
195mutex_newprocOwns coordination, scheduling, or concurrency behavior.
199mutex_lockprocOwns coordination, scheduling, or concurrency behavior.
203mutex_unlockprocOwns coordination, scheduling, or concurrency behavior.
207cond_newprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
211cond_waitprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
215cond_signalprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
219cond_broadcastprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
223channel_versionprocOwns coordination, scheduling, or concurrency behavior.
227channel_readyprocOwns coordination, scheduling, or concurrency behavior.
231channel_selftestprocOwns coordination, scheduling, or concurrency behavior.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 29 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 Queue<T> { (line 5)
  • form Channel<T> { (line 9)
  • form Select<T> { (line 20)
  • proc channel_new<T>(capacity: int) -> Channel<T> { (line 25)
  • proc channel_send<T>(ch: Channel<T>, value: T) -> bool { (line 39)
  • proc channel_recv<T>(ch: Channel<T>) -> T { (line 60)
  • proc channel_try_recv<T>(ch: Channel<T>) -> T { (line 79)
  • proc channel_is_closed<T>(ch: Channel<T>) -> bool { (line 95)
  • proc channel_close_sender<T>(ch: Channel<T>) -> bool { (line 99)
  • proc channel_close_receiver<T>(ch: Channel<T>) -> bool { (line 112)
  • proc channel_len<T>(ch: Channel<T>) -> int { (line 124)
  • proc channel_select<T>(channels: [Channel<T>]) -> Select<T> { (line 131)
  • proc queue_new<T>() -> Queue<T> { (line 153)
  • proc queue_push<T>(q: Queue<T>, value: T) -> bool { (line 160)
  • proc queue_pop<T>(q: Queue<T>) -> T { (line 165)
  • proc queue_len<T>(q: Queue<T>) -> int { (line 177)
  • proc queue_rest<T>(items: [T]) -> [T] { (line 181)
  • proc mutex_new() -> int { (line 195)

The list is intentionally capped here; the source file declares 27 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/channel.vitl is explicit.
  2. Read declared forms and picks before algorithms so the data vocabulary is stable in your head.
  3. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  4. 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_channel
use vitte/stdlib/async/channel
form UserReport {
  label: string,
  ready: bool
}
proc run_example() -> UserReport {
  let entries = queue_rest([])
  let ready: bool = channel_send(Channel<T>(), T())
  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 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
formyesyes
procyesyes
letyesyes
setyesyes
ifyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes

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

Source shape

space vitte/stdlib/async/channel
use vitte/stdlib/core
form Queue<T> {
  items: [T],
}
form Channel<T> {
  sender_count: int,
  receiver_count: int,
  queue: Queue<T>,
  mutex: int,

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/channel
  • Line 3: use vitte/stdlib/core
  • Line 5: form Queue<T> {
  • Line 9: form Channel<T> {
  • Line 20: form Select<T> {
  • Line 25: proc channel_new<T>(capacity: int) -> Channel<T> {
  • Line 39: proc channel_send<T>(ch: Channel<T>, value: T) -> bool {
  • Line 60: proc channel_recv<T>(ch: Channel<T>) -> T {

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: 30. Procedures: 24. Data surfaces: 3. Constants: 0.

First visible names: vitte/stdlib/async/channel, vitte/stdlib/core, Queue, Channel, Select, channel_new, channel_send, channel_recv, channel_try_recv, channel_is_closed

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.

Data surfaces

LineNameSignatureRole
5Queueform Queue<T> {Introduces a structured data shape that other procedures can exchange.
9Channelform Channel<T> {Introduces a structured data shape that other procedures can exchange.
20Selectform Select<T> {Introduces a structured data shape that other procedures can exchange.

Procedures

LineNameSignatureRole
25channel_newproc channel_new<T>(capacity: int) -> Channel<T> {Owns coordination, scheduling, or concurrency behavior.
39channel_sendproc channel_send<T>(ch: Channel<T>, value: T) -> bool {Owns coordination, scheduling, or concurrency behavior.
60channel_recvproc channel_recv<T>(ch: Channel<T>) -> T {Owns coordination, scheduling, or concurrency behavior.
79channel_try_recvproc channel_try_recv<T>(ch: Channel<T>) -> T {Owns coordination, scheduling, or concurrency behavior.
95channel_is_closedproc channel_is_closed<T>(ch: Channel<T>) -> bool {Owns coordination, scheduling, or concurrency behavior.
99channel_close_senderproc channel_close_sender<T>(ch: Channel<T>) -> bool {Owns coordination, scheduling, or concurrency behavior.
112channel_close_receiverproc channel_close_receiver<T>(ch: Channel<T>) -> bool {Owns coordination, scheduling, or concurrency behavior.
124channel_lenproc channel_len<T>(ch: Channel<T>) -> int {Owns coordination, scheduling, or concurrency behavior.
131channel_selectproc channel_select<T>(channels: [Channel<T>]) -> Select<T> {Owns coordination, scheduling, or concurrency behavior.
153queue_newproc queue_new<T>() -> Queue<T> {Owns a concrete data shape or the operations that maintain it.
160queue_pushproc queue_push<T>(q: Queue<T>, value: T) -> bool {Owns a concrete data shape or the operations that maintain it.
165queue_popproc queue_pop<T>(q: Queue<T>) -> T {Owns a concrete data shape or the operations that maintain it.
177queue_lenproc queue_len<T>(q: Queue<T>) -> int {Owns a concrete data shape or the operations that maintain it.
181queue_restproc queue_rest<T>(items: [T]) -> [T] {Owns a concrete data shape or the operations that maintain it.
195mutex_newproc mutex_new() -> int {Owns coordination, scheduling, or concurrency behavior.
199mutex_lockproc mutex_lock(id: int) -> bool {Owns coordination, scheduling, or concurrency behavior.
203mutex_unlockproc mutex_unlock(id: int) -> bool {Owns coordination, scheduling, or concurrency behavior.
207cond_newproc cond_new() -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
211cond_waitproc cond_wait(cond: int, mutex: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
215cond_signalproc cond_signal(cond: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
219cond_broadcastproc cond_broadcast(cond: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
223channel_versionproc channel_version() -> string {Owns coordination, scheduling, or concurrency behavior.
227channel_readyproc channel_ready() -> bool {Owns coordination, scheduling, or concurrency behavior.
231channel_selftestproc channel_selftest() -> bool {Owns coordination, scheduling, or concurrency behavior.

Imports

LineNameSignatureRole
3vitte/stdlib/coreuse vitte/stdlib/coreImports a sibling or supporting surface used by the module.

Exports

LineNameSignatureRole
253*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/channel.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/async.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/async.vitl293Shares 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