3.4 KiB
3.4 KiB
PBS IR and Lowering Workshop 2
Status: Active
Purpose
Run the second focused discussion for 12. IR and Lowering Specification.md on control flow and propagation:
- evaluation order,
- branching,
- abrupt completion,
optional,result,!,- and
handle.
Why This Slice Second
This slice follows naturally from Workshop 1 because it applies the preserved-obligations model to the core execution constructs.
Proposed Meeting Order
- Reconfirm the preserved semantic obligations from Workshop 1.
- Close evaluation-order preservation in lowered form.
- Close the lowered model for branching and abrupt completion.
- Close the lowered model for
optionalandresultpropagation. - Record callable and runtime-artifact issues for Workshop 3.
Decisions To Produce
- How evaluation order is preserved explicitly.
- How abrupt completion is represented in lowered control flow.
- The lowered shape of
optional else,expr!, andhandle. - The boundary between propagation and trap in lowering.
Candidate Decisions
1. Lowering Must Make Single Evaluation Explicit
Candidate direction:
- call target formation,
- argument evaluation,
ifconditions,switchselectors,some(expr)payload formation,- and
bind(context, fn_name)capture must each lower to explicit once-only evaluation points.
Rationale:
- These are already language-observable guarantees.
2. Branching Lowers To Explicit Control Transfers
Candidate direction:
ifandswitchlower to explicit branch structure,- non-selected arms do not evaluate,
- and tail-result formation is explicit rather than implicit.
Rationale:
- This keeps the dynamic-semantics contract visible through lowering.
3. Propagation Uses Dedicated Lowered Paths
Candidate direction:
optional elselowers to a presence test plus fallback path,expr!lowers to success-path unpack plus immediate error propagation path,handlelowers to explicit arm dispatch over the error case space.
Rationale:
- These constructs are semantically distinct enough that ordinary expression lowering should not blur them.
4. Trap Is Not Rewritten Into Result Flow
Candidate direction:
- lowered trap paths remain fatal abort paths outside ordinary
resultpropagation, - and
handlenever intercepts trap.
Rationale:
- This preserves the existing semantics cleanly.
Questions To Resolve In The Room
- Does
12need dedicated abstract operations for propagation, or only obligations on the emitted control flow? - How explicit must once-only evaluation be in the spec text?
- Does
switchlowering need one canonical decision-tree shape? - Is
handlebest specified as arm dispatch plus remap semantics, or as a more abstract effect-preservation rule? - Which of these details belong to
12versus15?
Expected Outputs
- a decision record for evaluation-order preservation,
- a decision record for propagation lowering,
- and control-flow section targets for
12.
Explicit Deferrals For Workshop 3
- services,
- contracts,
- callbacks,
- and runtime dispatch artifacts.
Inputs
docs/pbs/specs/9. Dynamic Semantics Specification.mddocs/pbs/specs/10. Memory and Lifetime Specification.mddocs/pbs/specs/12. IR and Lowering Specification.mddocs/pbs/agendas/12. IR and Lowering Agenda.mddocs/pbs/agendas/12.1. IR and Lowering Workshop 1 - Lowering Contract and IR Status.md