Concurrency
Use async functions and typed workers without a fiber runtime
VibeLang keeps ordinary async functions. Expected async failure is Promise<Result<A, E>>, and await unwraps only the Promise.
Promise Discipline
Authored .vibe code cannot call Promise instance .then(), .catch(), or .finally(). Use await, then inspect or propagate the Result:
const userResult = await loadUser(id)
const user = userResult.unwrap()Imported TypeScript and JavaScript libraries may use Promise chaining internally. Rejections crossing an undescribed foreign boundary become UnhandledException.
Typed Workers
const analytics = spawn module {
export function summarize(
values: Float64Array,
): Result<Summary, InvalidSample> {
return Statistics.summarize(values)
}
}Calls across a worker boundary retain Result types. Values and Errors crossing realms must satisfy the derived transport codec.
Join Concurrent Operations
Start work with a static or library combinator and consume the Promise with await:
const results = await Promise.all([
loadProfile(id),
loadActivity(id),
])
const [profile, activity] = Result.all(results).unwrap()Promise.all handles Promise scheduling. Result.all collects the successful values or returns the first Error. This uses standard call syntax and introduces no special await.all grammar.
Cancellation
Cancellation is an expected Error and its source is a capability:
async function index(
records: AsyncIterable<Record>,
): Promise<Result<void, Cancelled>> {
const cancellation = Cancellation.context()
for await (const record of records) {
cancellation.checkpoint().unwrap()
indexRecord(record)
}
}Callers can distinguish cancellation from timeout or domain failure.
Shared Data
Shared structs over SharedArrayBuffer provide an explicit path for high-throughput worker communication. Ordinary mutable objects are not silently shared between realms. The compiler checks cross-realm layout and error transport while each backend selects its implementation.
Limiting Fan-Out
Concurrency governors limit how much work may run simultaneously; they do not define child ownership or Error composition. VibeLang intends to follow viable JavaScript proposals or standard-library APIs instead of adding parser syntax for throttling.
Open Semantics
Sibling cancellation, join ordering, aggregate-error policy, worker lifetimes, and custom thenable portability remain specification work. A Flow's durable scheduler is a separate opt-in runtime, not the execution model for ordinary async code.