Keikaku documentation

The Asynchronous Layer

Keikaku’s async support builds on the generator/coroutine machinery. Functions become non-blocking with async protocol (or async sequence), and await pauses execution until a promise resolves or a generator yields, a uniform suspension point across both. Promises are represented as objects, and resolve(value) constructs an already-resolved promise that await can consume. The documented pattern is idiomatic async/await: an async protocol main() does user := await fetch_user(1) then posts := await fetch_posts(user) and declares both, driven by await main().

Two scheduling primitives complete the layer. defer(delay, fn, args...) schedules a function call for later execution (defer(500, declare, "Executed after 500ms")), and sleep(ms) pauses for a duration in milliseconds. The async layer deliberately mirrors mainstream async/await semantics so it is immediately usable, while keeping Keikaku’s themed protocol/sequence vocabulary. Because await suspends on both promises and generator yields through the same mechanism, the async and generator systems are two faces of one underlying coroutine runtime.

Explore the research

Search projects, documentation, publications, and disclosures.