Repository navigation
Conversation
|
Design decision, 2026-10-07, decided by the project owner: accepted.
|
The project owner decided six open design questions on 2026-10-07: orchestration starts as a std.orchestrate library (#723, #1393 closed), request and persistent lifetime domains (#1369), @Lifetime on struct fields with LD5 (#1358), last-use moves without a move keyword or COW (#1354), the type reflection API at Experimental stability (#1365), and the Linux release qualification policy (#1399). Questions.md archives each one. The Flow 3.0 tracker records the library-first rule for orchestration. Follow-up on persistent and TransportSafe is #1421.
The project owner decided six open design questions on 2026-10-07: orchestration starts as a std.orchestrate library (#723, #1393 closed), request and persistent lifetime domains (#1369), @Lifetime on struct fields with LD5 (#1358), last-use moves without a move keyword or COW (#1354), the type reflection API at Experimental stability (#1365), and the Linux release qualification policy (#1399). Questions.md archives each one. The Flow 3.0 tracker records the library-first rule for orchestration. Follow-up on persistent and TransportSafe is #1421.
The project owner decided six open design questions on 2026-10-07: orchestration starts as a std.orchestrate library (#723, #1393 closed), request and persistent lifetime domains (#1369), @Lifetime on struct fields with LD5 (#1358), last-use moves without a move keyword or COW (#1354), the type reflection API at Experimental stability (#1365), and the Linux release qualification policy (#1399). Questions.md archives each one. The Flow 3.0 tracker records the library-first rule for orchestration. Follow-up on persistent and TransportSafe is #1421.
The lattice is callback < frame < request < session < application < persistent, as accepted on 2026-10-07 (docs/project/Questions.md). LD1-LD4 apply to both. request may allocate and is not @rt_safe. persistent is the outermost domain: an application pointer may not be stored in a persistent static, and an @Lifetime(application) function may not call a persistent one. Compact summaries encode unannotated callables as domain rank 6. Rebased from PR #1369 onto current main; doc conflicts with region inference (#1390) and the arena-domain rows (#690) kept both sides. Whether persistent values must be TransportSafe is #1421. The #690 arena-domain check hard-coded application as 3, which is session once request is inserted; it now uses FLOWC_RT_DOM_APPLICATION (domain_arena_ok_unannotated failed without this).
…ains Fixed point at gen2; bootstrap_from_c.sh --verify passes.
LD1 now follows stores through struct fields, nested fields and array elements of a static, so a shorter-lived reference parked inside composite storage is an escape. @Lifetime(D) on a struct field is a contract (rule LD5): the field may only hold D-domain or longer references, wherever the instance lives. Accepted in the 2026-10-07 decision; merges after #1369. Rebased from PR #1358 onto #1369 (request/persistent) and current main. The assignment-check conflict with main keeps the local_storage guard on "span outlives borrowed storage"; doc conflicts keep both sides.
Fixed point at gen2; bootstrap_from_c.sh --verify passes.
87a8622 to
58d13fd
Compare
|
Prepared for merge, stacked on #1369 as the 2026-10-07 decision requires ("#1358 merges after #1369"). The base branch is now
Gates on the stack: flowc selftest PASS; |
82bf008 to
b729c62
Compare
LD1 now follows stores through struct fields, nested fields and array elements of a static, so a shorter-lived reference parked inside composite storage is an escape. @Lifetime(D) on a struct field is a contract (rule LD5): the field may only hold D-domain or longer references, wherever the instance lives. Accepted in the 2026-10-07 decision; merges after #1369. Rebased from PR #1358 onto #1369 (request/persistent) and current main. The assignment-check conflict with main keeps the local_storage guard on "span outlives borrowed storage"; doc conflicts keep both sides.
b729c62 to
64daee6
Compare
LD1 now follows stores through struct fields, nested fields and array elements of a static, so a shorter-lived reference parked inside composite storage is an escape. @Lifetime(D) on a struct field is a contract (rule LD5): the field may only hold D-domain or longer references, wherever the instance lives. Accepted in the 2026-10-07 decision; merges after #1369. Rebased from PR #1358 onto #1369 (request/persistent) and current main. The assignment-check conflict with main keeps the local_storage guard on "span outlives borrowed storage"; doc conflicts keep both sides.
Intent
Linked issue or roadmap item: #684 (epic #679). Archive reference:
archive/feat/684-domain-fields.What changed, and why is this the smallest useful change?
The v0 lifetime-domain checker tracked direct locals and module statics. This extends domain representation to struct fields and collections so a shorter-lived reference stored through a field path, array element, or struct/array literal is an escape (LD1), and a field may declare
@lifetime(D)as a contract (LD5).Closes #684
Overlap check
Overlap / dependency notes:
Sibling agents are on #690 (arena domain binding), #694 (region/alias inference), #696 (move defaults), and #765 (cross-module
@rt_safe/@lifetimesummaries). This PR does not touch those. Open PRs reviewed: #1342 is #765, #1328 is MLIR static-memory ranges, #1348 is #766 closures. No live implementation of #684.Evidence
Baseline before this change:
holder[0].view = &scratchinto an application static,table[0][0] = &scratch, and@lifetime(application)on a field all compiled.Targeted proof that exercises the changed behaviour:
compiler/fixtures/typecheck_rules/domain_field_*.flow,domain_array_*.flow,domain_ld5_*.flow,domain_return_struct.flow,domain_struct_lit_static.flow; accepted programtests/lang/test_domain_fields.flow; C erasuretests/cgen/domain_fields_no_trace.flow.Why that proof would detect the old failure or regression:
Each negative fixture demands the exact domain-escape diagnostic. The accepted program would fail to typecheck if LD5 grew false positives. A new regression test fails on the old behaviour: the old checker did not parse
@lifetimeon fields and did not walk struct/array literals for domain roots.Repository gate(s) run:
env -u FLOWC_IN -u FLOWC_OUT "$(./flow tool compiler/scripts/flowc_host.flow)"→flowc: PASS./flow tool compiler/scripts/typecheck_rules.flow→144 passed, 0 failed(host and new bootstrap)./flow test-lang tests/lang/test_domain_fields.flow tests/lang/test_lifetime_domains.flow→ both pass./flow tool tests/cgen/run.flow domain_fields_no_trace lifetime_domains_no_trace→ both PASS./compiler/scripts/bootstrap_from_c.sh --verify→PASS bootstrap C matches compiler/src (self-reproducing)Generated/bootstrap state, if any:
compiler/bootstrap/flowc_stage_a.cregenerated in a separate commit after source edits.--verifypassed (fixed point at gen2).Risk
Compatibility, performance, security, lifetime, backend, or release implications:
Opt-in extension of
@lifetimeto struct fields. Existing unannotated programs are unchanged. Annotation is erased before codegen.docs/project/Questions.mdupdated if this needs a language-design decision.Compatibility
docs/project/CHANGELOG.md.@lifetime(D)is now accepted on struct fields. New hard errors only fire when both the writer and the target opt in (or the target is a longer-lived static). Module statics that hold a composite remainptr<T>(struct-typed module statics are still rejected).Agent handoff
Acceptance criteria are met: field domains are recorded, shorter-lived stores into longer-lived fields/collections are rejected, tests cover nested structs and containers, docs are registered in
docs/nav.json. Not merging.