2.6 KiB
2.6 KiB
Globals, Lifecycle, and Published Entrypoint
Original Problem
Topic 19 closed the biggest remaining executable-model gap in PBS:
- explicit globals,
- lifecycle markers,
- program initialization,
- published wrapper ownership,
FRAME_RETplacement,- hidden boot state,
- and the compiler-to-backend handoff contract.
Consolidated Decision
PBS now has one coherent lifecycle model.
The durable rules are:
- Globals are explicit source-level declarations with stable identity and module ownership.
- Lifecycle is source-driven through
[Init],[Frame], and related static rules. - The user
[Frame]function is the logical frame root. - The published physical entrypoint is a synthetic compiler-owned wrapper.
- The wrapper owns final
FRAME_RET. - Boot is one-shot and enforced through a hidden compiler-owned boot guard.
- Hidden lifecycle artifacts must be structurally distinguishable from userland globals and userland callables.
- Backend handoff must preserve wrapper identity, hidden global identity, origin metadata, and physical entrypoint index
0.
Final Model
The executable model is now:
- per-file init fragments,
- per-module synthetic init,
- project init,
- a published wrapper at physical entrypoint
0, - a hidden
BOOT_GUARD, - and user
frame()as the logical callable invoked by the wrapper.
This is the key conceptual split:
- userland owns the logical frame root,
- the compiler owns the physical boot protocol.
That separation keeps the language surface clean while still giving the backend and runtime a deterministic boot contract.
Practical Consequences
- Executable PBS projects must declare an explicit
[Frame]. - Entrypoint authority no longer belongs to manifest metadata or nominal export lookup.
- Hidden compiler lifecycle state must not be modeled as ordinary user globals.
- Lowering and tests should prove wrapper publication, wrapper ordering, guard presence, and guard semantics.
Common Pitfalls
- Treating
frame()itself as the physical entrypoint. - Reintroducing manifest-driven entrypoint authority.
- Recognizing hidden lifecycle artifacts only by naming convention.
- Forgetting that boot must be one-shot across frames, not merely “present in the graph”.
Source Decisions
Globals Surface, Identity, and Module Boundaries Decision.mdLifecycle Markers, Program Init, and Frame Root Semantics Decision.mdPublished Entrypoint, Synthetic Wrapper, and FRAME_RET Ownership Decision.mdGlobals and Lifecycle Lowering to IRBackend and IRVM Decision.mdDiagnostics, Manifest Propagation, and Conformance Coverage Decision.md