Repository navigation
Lifetime domains and type reflection train: #1369, #1437, #1358, #1365 - #1369
Conversation
|
CI diagnosis: the new |
|
Design decision, 2026-10-07, decided by the project owner: accepted.
Follow-up opened as #1421: whether values stored in This PR joins the merge queue. It still needs a rebase on current main and a bootstrap C regeneration in its own commit before merge. #1358 merges after it. Recorded in docs/project/Questions.md by #1422. |
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).
5f107a6 to
89827b6
Compare
|
Prepared for merge on main
Gates on the rebased tree: flowc selftest PASS; |
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.
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).
82bf008 to
b729c62
Compare
Decided 2026-10-07: persistent outlives the process, so it may not hold a pointer, span, string or other reference into process memory. A @Lifetime(persistent) static whose declared type is not TransportSafe (#1340) is rejected, naming the field or element type that carries the reference. flowc_type_transport_blocker in type_id.flow follows the existing TransportSafe walk and returns the innermost offending field or type. Checking the declaration covers every store into the static. domain_application_escape_persistent becomes domain_persistent_pointer_static; domain_persistent_string_array is new. The language test stores and reads back persistent i64 and [i32; 2] statics. From PR #1437, which was merged into the #1369 branch.
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.
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).
Decided 2026-10-07: persistent outlives the process, so it may not hold a pointer, span, string or other reference into process memory. A @Lifetime(persistent) static whose declared type is not TransportSafe (#1340) is rejected, naming the field or element type that carries the reference. flowc_type_transport_blocker in type_id.flow follows the existing TransportSafe walk and returns the innermost offending field or type. Checking the declaration covers every store into the static. domain_application_escape_persistent becomes domain_persistent_pointer_static; domain_persistent_string_array is new. The language test stores and reads back persistent i64 and [i32; 2] statics. From PR #1437, which was merged into the #1369 branch.
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.
#775) The remaining slice of #775. @schema_revision(N) on structs, enums and aliases feeds type_schema_id without changing type_family_id. type_member_count<T>() and type_member_table<T>() expose the members. type_sizeof_*, type_alignof_* and type_layout_* give native64 and wasm32 layout descriptors separately from the semantic IDs. The names are public at Experimental stability per the 2026-10-07 decision; stability/surfaces.json gains a type-reflection surface. Rebased from PR #1365 onto current main (CHANGELOG conflict kept both sides).
@schema_revision (#775) is the 23rd attribute. Six corpus programs import compiler/src/parser.flow or attributes, whose MLIR changes with the train; their digests are re-recorded with parity_mlir --record, and only those six rows are taken.
…tion train Fixed point at gen2; bootstrap_from_c.sh --verify passes.
…ion on the lane C base
b729c62 to
64daee6
Compare
Lane A train: #1369, #1437, #1358 and #1365, landed as one squash with one bootstrap regen.
Part of #679
Fixes #1421
Closes #684
Closes #775
What is in the train
requestandpersistentlifetime domains. The lattice iscallback < frame < request < session < application < persistent. LD1 to LD4 apply to both. The [Flow 2.0] Domain-bound allocation tracking for arenas and heap regions #690 arena-domain check now usesFLOWC_RT_DOM_APPLICATIONin place of a hard-coded 3.@lifetime(persistent)static must have a TransportSafe type. feat: persistent statics must be TransportSafe (#1421) #1437 was stacked on Lifetime domains and type reflection train: #1369, #1437, #1358, #1365 #1369 and was merged into the Lifetime domains and type reflection train: #1369, #1437, #1358, #1365 #1369 branch at 16:21 UTC, so it never reached main. Its source changes are carried here as their own commit; its bootstrap commit is dropped.@lifetime(D)on a struct field and rule LD5 (accepted 2026-10-07 in docs/project/Questions.md).@schema_revision(N),type_member_count/type_member_table, and native64 / wasm32 size, align and layout certificates, registered as experimental instability/surfaces.json(accepted 2026-10-07).Test bookkeeping:
@schema_revisionis the 23rd attribute, sotests/scripts/doc_coverage.flowexpects 23. Seven corpus programs that importcompiler/src/parser.flowor the attribute table have new MLIR digests incompiler/fixtures/mlir/corpus.txt, recorded withparity_mlir --record; only those rows were taken.Each PR's bootstrap commit was dropped. The bootstrap C was regenerated once, last, as its own commit (fixed point at gen2,
bootstrap_from_c.sh --verifypasses).Conflicts resolved per hunk, keeping both sides:
docs/language/spec-index.md(domain fields link plus main's MLIR value semantics link),compiler/src/type_id.flow(flowc_type_transport_blockerfrom #1421 next to the #775 exports),docs/LANGUAGE_SPEC.md(attribute placement text and table rows from both),docs/language/types.md,docs/project/CHANGELOG.md.Gates (macOS arm64, on main 2001007; pushed rebased onto 068425f, which changes no compiler/src)
--verifyPASSRisk
Compiler front end only (type checker, attributes, type identity). Compact summary domain ranks shift by the two new domains, so any out-of-tree summary consumer must use the
FLOWC_RT_DOM_*constants.