3.1 KiB
3.1 KiB
PBS Heap Model - Discussion Agenda
Status: Working agenda (pre-spec)
Purpose: define how PBS will expose heap usage after the RC/HIP era
1. Context
Legacy PBS experiments used explicit RC/HIP syntax (alloc, borrow, mutate, peek, take, weak).
Current runtime authority is GC-based with deterministic safepoints.
We need a clear PBS heap story that:
- stays compatible with closed VM/runtime authority,
- remains simple for beginners,
- gives advanced developers explicit performance control,
- keeps frame-time behavior predictable.
2. Decisions to Produce
This agenda must end with decisions for:
- Heap surface in core language (what is in/out of core syntax).
- Heap control surface in stdlib/tooling (what is explicit but optional).
- Cost visibility contract (what diagnostics/profiling must report).
- Migration policy from legacy RC/HIP concepts.
3. Core Questions
Q1. Baseline model
- Is GC always the default execution model for PBS core? (expected: yes)
- Are there any mandatory explicit lifetime constructs in core syntax? (expected: no)
Q2. Language vs library boundary
- Should explicit memory workflows live in syntax or only in stdlib APIs?
- Which old RC/HIP concepts become API patterns instead of keywords?
Q3. Reserved keywords strategy
- Keep
alloc/borrow/mutate/peek/take/weakreserved only? - Or activate a subset in a future opt-in profile?
- What hard criteria must be met before activation?
Q4. Determinism and frame budget
- How do we guarantee predictable frame behavior under GC pressure?
- What static/dynamic tooling must warn on hot-path allocations?
Q5. Heap collections and identity semantics
- What collection semantics are required in v1 stdlib for games?
- Which operations must be explicit due to allocation/copy costs?
Q6. Host memory boundary
- How does PBS communicate "VM heap vs host-owned memory" to users?
- Which host calls may allocate, and how should that appear in diagnostics?
Q7. Advanced performance patterns
- Should pools/reuse patterns be standardized as library primitives?
- If yes, what minimum API contract is required (without changing VM model)?
Q8. Error and safety model
- Which heap-related failures become traps vs status values?
- What compile-time checks are mandatory for safer defaults?
4. Proposed Output Documents
After discussion, produce:
4. Static Semantics Specification.md(binding/mutability/type rules impacted by heap model).5. Dynamic Semantics Specification.md(evaluation and runtime-visible behavior).6. Memory and Lifetime Specification.md(authoritative PBS heap model).9. Diagnostics Specification.md(heap/cost diagnostics contract).
5. Non-Goals for This Agenda
- Defining new VM opcodes.
- Reintroducing RC as mandatory runtime strategy.
- Designing full stdlib APIs in this discussion pass.
6. Working Assumptions (to validate)
- GC remains baseline for PBS core.
- Explicit heap control is opt-in and likely library/tooling-driven.
- Deterministic behavior and frame-sync constraints are non-negotiable.
- Language should expose cost signals without forcing expert-only syntax.