Define async completion, cancellation, and frame lifetime semantics
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
Parent: #439
## Problem
Wave needs an explicit semantic contract before parser, runtime, and backend implementations choose incompatible behavior. The contract must fit Wave's general-purpose, low-level model without importing Rust ownership rules or an LLVM coroutine ABI.
## Scope
- Define the source meaning of `async fun name(...) -> T` and `await expression`.
- Decide the concrete frontend representation of an asynchronous result, including whether users spell a built-in `Future` type directly.
- Define completion, pending, failure, cancellation, and executor-shutdown behavior.
- Define which locals live in the suspended frame and when frame storage is released.
- State that raw pointers retained across an await keep Wave's existing programmer-managed validity contract.
- Decide private `async fun main()` behavior and executor ownership.
- Reject async `extern`, `export`, constructors, and other unsupported declaration forms with diagnostics until their ABI exists.
- Specify how async functions interact with generics, variants, recursion, and imports.
## Completion criteria
- [ ] A concise normative contract covers call, suspension, resumption, completion, and cancellation.
- [ ] Surface examples and invalid examples are agreed.
- [ ] No rule introduces `let`, a borrow checker, or mandatory `unsafe` blocks.
- [ ] LLVM and Whale can implement the contract without exposing backend-specific frame layout.
- [ ] Follow-up syntax, HIR, lowering, runtime, and std issues reference the decisions.
This is a design issue; implementation belongs in the focused child issues.
Contributor guide
Research direction
Start with parent issue #439 and the listed semantic questions, then organize decisions for async calls, suspension, completion, cancellation, frame lifetime, declarations, and type-system interactions. Done means a concise normative contract, agreed valid and invalid examples, backend-independent rules, and references for the follow-up syntax, HIR, lowering, runtime, and standard-library issues.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100