natives: design record for IR bodies of native fn and native { } (step 1 of #53) #410
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Step 1 of #53 (natives:
native fnbodies as IR andnative { }blocks; ROADMAP "The kernel of natives", CONCEPT "Foreign Functions"). CONCEPT plans that the body of anative fnis IR andnative { ... }a block of IR inside an ordinary function, but no design record fixes the concrete surface: what the IR looks like as source, what the checker accepts, how it is lowered. That has to be decided in writing before the parser, checker or lowering is touched. This step is documentation only.Goal
A design record
docs/design/NATIVE-BODIES.mdthat specifies the syntax, the checker rules and the lowering of IR bodies, and cuts the implementation into slices.Acceptance criteria
docs/design/NATIVE-BODIES.mdexists with pdisc frontmatter, a status line ("designed, not built") and an entry indocs/design/index.md.native fn add(other: Int64): Int64 { ... }(a kernel operation such asInt64.add) and anative { ... }block inside an ordinary function: how an intrinsic and its numeric kind are written (aligned with the IR text of BACKEND 1.7 and theIntrinsic/IntrinsicOperationnames), how parameters,selfand the result are named inside the body, how ownership and the checked-versus-unchecked variants are spelled.nativebodies and blocks are allowed (std/only, as CONCEPT says until the IR format is versioned), what is verified at the site (IR verifier: form, slot types, ownership; not meaning), the error text for each refusal, and how a bodilessnative fn(the platform edge: files, clock, processes) stays unchanged.Intrinsicpath as today's manifest wrapper; a back end that lacks an intrinsic reports a clean compile error (BACKEND gap 22); the manifest (natives.trb) entries that the bodies replace are named, with the migration order owed to the audit table of #52 (docs/design/NATIVES.md, #407, if already landed; otherwise the manifest itself).std/), and lists the slices: (1) syntax and parser with a gate test, (2) checker rules, (3) lowering in the VM and C back end, (4)stdmigrates its arithmetic (Int64.addand the other kernel rows). Each slice fits one PR of one or two Conventional Commits.docs/regeneratesskills/asCLAUDE.mdrequires; gates green in both tiers.Design record point
CONCEPT "Foreign Functions (Draft)" (planned: the body of a
native fnis IR); ROADMAP "The kernel of natives"; BACKEND 1.7 (IR text), 3.7 (the manifest) and gap 22 (missing intrinsic is a compile error).Seed impact
None for this step (documentation only). The later slices change syntax and add a name the compiler parses, so they fall under the two-commit rule; the seed refresh itself stays Torben's.
Size
One PR, one Conventional Commit (
docs(natives): design record for IR bodies of native fn).Dependencies
None hard. It should read the kernel list from
docs/design/NATIVES.mdonce #407 (PR #409) has landed. Blocks the implementation slices of #53; part of #52.native fnbodies as IR andnative { }blocks #53native fnbodies as IR andnative { }blocks #53[loop:torbscript] claim implement by session:loop-torbscript-20261023 until 2026-10-23T09:39:20Z
[loop:torbscript] implement: design record
docs/design/NATIVE-BODIES.mdwritten (grammar and examples fornative fnandnative { }, intrinsic typing table, checker rules N1-N10 with error texts, lowering through the existingIntrinsicpath in C and the VM, manifest rows replaced, four slices with seed impact, technical questions decided in section 9, none left for the owner); linked from CONCEPT, ROADMAP anddocs/design/index.md. PR #412 (Closes #410), commit-message check clean locally. Forge CI has not started: all four checks of the PR sitpendingfor 30+ min because the runners are backlogged (runs 1355-1360 and others arewaiting), no result yet. Deviation: design records here are plain Markdown named in thedocumentslist of the index, so the record has no front matter; thepdisccheck of the PR will say if that is wrong. Not run locally:torb format --check(no.trbtouched, no torb binary in the sandbox). Tokens: roughly 130k.next: waiting (forge CI queued on 3 runners backlog, then review by argus)
ArrayList, the hash tables and the tries onBuffer(step 1 of #55) #413[loop:torbscript] claim implement by session:loop-torbscript-20261023 until 2026-10-23T10:27:00Z
[loop:torbscript] implement: PR #412 (#412) pdisc fixed on head
8a40ca84: CONCEPT.md was stale after the link to docs/design/NATIVE-BODIES.md, restamped with pdisc.py stamp; locallypdisc.py checkand the index are ok; the PR is mergeable without a rebase, no merge commit. next: waiting (forge CI runners are queued; pdisc, commit messages and gates on the new head are still pending, no failure) - then the merge gate (argus) reviews.native fnbodies andnative { }blocks, with a parser gate test (step 2 of #53) #467native fnbodies andnative { }blocks, kernel test (step 4 of #53) #484native fnbodies as IR andnative { }blocks #53native fnbodies as IR andnative { }blocks #53native fnbodies as IR andnative { }blocks #53