Concurrency
tulam’s concurrency model is intended to be effect-based, structured, and typed. It does not require dedicated concurrency grammar in the current language revision.
Implementation status: Structured concurrency, channels, actors, and STM remain designed library facilities rather than completed native language support.
Structured scopes
Representative APIs have the shape:
withScope(fn(scope) = ...)
spawn(scope, fn() = work())
await(task)A task belongs to a scope whose type controls lifetime and cancellation. Work cannot silently outlive the resource context that owns it.
Channels, actors, and STM
Libraries can expose typed channels and actor mailboxes. Software transactional memory uses transaction-scoped operations:
atomically(fn(tx) = ...)
readTVar(tx, cell)
writeTVar(tx, cell, item)The transaction token prevents operations from escaping their valid scope.
Cancellation and effects
Cancellation is an observable exit path for deep handler finalization. Capabilities used by tasks remain in effect rows, and resource duplication must respect continuation and ownership evidence.
Parallel computation
Parallel collection combinators and accelerated bulk providers belong to typed libraries and target capabilities. There is no parallel keyword or implicit promise that ordinary code is safe to duplicate.
Runtime independence
A provider may implement tasks using OS threads, work stealing, managed tasks, JavaScript promises/workers, or remote execution while preserving the same structured semantics. Scheduler choices are not new surface languages.
No premature sugar
spawn, await, and related names are library APIs, not reserved words. Future ergonomic syntax requires an explicit surface-language decision after the underlying types are stable.
Common mistakes
Do not write these library-shaped examples as if their native implementations already existed, let tasks escape their scopes, or assume ordinary functions may be duplicated safely merely because a provider can run in parallel.
Recap
The intended concurrency model combines scope-indexed library types, effects, cancellation, and ownership. It deliberately adds no concurrency grammar in the current language revision.
Normative direction: Language Reference §17 and Concurrency Design.