Skip to content

Design: C realization of the shared CompilationUnit linkage-unit shape (R3 .h/.c + include-closure + link-cyclic; R4 permissive) - #6717

Merged
briansrls merged 2 commits into
mainfrom
c-linkage-unit-realization-design
Jul 16, 2026
Merged

briansrls merged 2 commits into
mainfrom
c-linkage-unit-realization-design

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Design artifact (docs-only) — the C realization of the shared, target-agnostic CompilationUnit contract locked with the Rust realization (docs/plans/emitted-crate-partition-design.md, PR #6708). C is staffed as the 2nd realization specifically to stress-test that the shared shape doesn't silently cement Rust's acyclic-linkage assumption.

Why C

Rust crates (and Go packages) require acyclic linkage; C translation units may mutually #include/reference and still link cleanly. Proving the same CompilationUnit shape expresses both — Rust R4 refusing a cyclic partition, C R4 accepting the identical cyclic partition — is the discriminating test that the shape is genuinely agnostic.

What this doc covers

  • C R3 (linkage spelling): .h/.c split renders the existing members(input)/interface(derived) fields — no shape change needed; cross-unit reference = #include + forward-decl from deps; translation-unit identity = preprocessor include-closure; artifact = .o + link step (extends the #6650 cc host transport).
  • C R4 (validity predicate): permissive on cyclicity (the key contrast with Rust R4); refuses only on cyclic by-value type containment or a split symbol definition — typed, located, never a widened fallback.
  • Acceptance: grounded on v2.std.determinism/std.perturbation (partition = non-semantic perturbation axis, same as the Rust doc — no new concept). Four discriminating witnesses: 1-unit, N-unit-acyclic, N-unit-cyclic (load-bearing — proves the C axis), and a genuinely-invalid partition's typed refusal.
  • Verdict: yes — the locked shape expresses C's axes without contortion. One non-blocking richness call-out to the shared-home author (sibling lane, adhoc-85078326-fdb): interface must be able to carry a full type definition for by-value boundary crossings, not just a symbol name — expected already true since it's an opaque Node carrier, flagged for confirmation, not filed as a shape-break escalation.

Staging

Design only. Implementation is gated on the shared home (CompilationUnit/partition_fold/R4 interface/Provenance) landing (sibling lane) + main-green, mirroring the Rust design doc's gating.

🤖 Generated with Claude Code

briansrls and others added 2 commits July 16, 2026 05:07
…e (R3 .h/.c + include-closure + link-cyclic; R4 permissive)

2nd realization (against the interface locked with the Rust realization,
docs/plans/emitted-crate-partition-design.md) staffed specifically to
stress-test that the shared CompilationUnit shape doesn't bake in Rust's
acyclic-linkage assumption. Verdict: yes, the locked shape expresses C's
.h/.c split and link-cyclic axis without contortion — R3 renders
members/interface into .c/.h, R4 accepts the cyclic partitions Rust R4
refuses and instead refuses on cyclic by-value type containment or a
split symbol definition. One non-blocking richness call-out to the
shared-home author: interface must carry full type definitions for
by-value crossings, not just symbol names.

Design only — implementation is gated on the shared home landing
(sibling lane, adhoc-85078326-fdb) + main-green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@briansrls
briansrls force-pushed the c-linkage-unit-realization-design branch from aee7d08 to 8f9f539 Compare July 16, 2026 05:10
@briansrls
briansrls merged commit 6c9a9c4 into main Jul 16, 2026
3 checks passed
@briansrls
briansrls deleted the c-linkage-unit-realization-design branch July 16, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant