Skip to content

Expand unit 6b: includes, computed constants, inline functions - #55

Merged
EvanWinget merged 2 commits into
mainfrom
unit-6b-scope-expansion
Aug 16, 2026
Merged

Expand unit 6b: includes, computed constants, inline functions#55
EvanWinget merged 2 commits into
mainfrom
unit-6b-scope-expansion

Conversation

@EvanWinget

Copy link
Copy Markdown
Owner

What changed

Docs only, plus one line-item in the reference fetch script. No spec or implementation contact, so no spec section applies. The unit 6b bullet in docs/execution-plan.md is rewritten: scope expands from a bare include mechanism to source-level include of shared constants and functions, computed compile-time constants, and inline functions, and the unit is resequenced ahead of unit 7. Unit 7's style constraint is widened to admit the new surfaces. tools/fetch-references.sh gains the two corpora the decision cites.

Why

A census of the two deployed-puzzle corpora (tibetswap b82e921, chia-gaming cdab9c9) found:

  • Every production puzzle file in both corpora imports shared definitions (all 12 tibetswap puzzles, all 19 chia-gaming non-test puzzle files, about 200 import and include statements in the latter).
  • tibetswap defines 124 of 136 functions inline, the single cheapest on-chain cost lever and directly relevant to Phase 4's vbyte measurements.
  • chia-gaming uses computed compile-time constants (defconst) 36 times.
  • let is effectively unused: two occurrences across both corpora, both in test files, so it stays out.
  • assign appears only in chia-gaming (about 20 on-chain uses), so it stays held on unit 7 evidence, now with a pre-registered trigger.

The census also corrected the prior deferral's premise. chia-gaming did not abandon source-level import: its imports are universal, and the compiled-sibling hash plumbing the old bullet described lives in its build layer, not its language. That import mechanism stays deferred, with bitlisp-compile -T covering the need manually.

Decision by Evan, 2026-08-16, skeleton change under ground rule 6.

Read order

  1. docs/execution-plan.md (the unit 6b bullet, then the unit 7 style constraint)
  2. tools/fetch-references.sh

Verify independently

tools/fetch-references.sh
# includes are universal (expect 22 statements across all 12 tibetswap puzzles):
grep -rc "(include" --include="*.clsp" references/tibet/clsp
# tibetswap inline ratio (expect 124 vs 12):
grep -rhoE "[(]defun-inline |[(]defun " --include="*.clsp" --include="*.clib" references/tibet/clsp references/tibet/include | sort | uniq -c
# let is test-only across both corpora (expect 2 hits, both under clsp/test):
grep -rnE "[(]let[*]?[ (]" --include="*.clsp" --include="*.clinc" references/chia-gaming/clsp references/tibet
PATH=.venv/bin:$PATH ci/lint/lint.sh

…tions

A two-corpus census (tibetswap b82e921, chia-gaming cdab9c9) found
source-level import of shared definitions in every production puzzle
file, tibetswap defining 124 of 136 functions inline, chia-gaming
using computed compile-time constants 36 times, and let effectively
absent at two uses, both in test files. The census also corrected
the deferral's premise: chia-gaming's source imports are universal
(about 200 import and include statements across 19 puzzle files),
and its compiled-sibling hash plumbing lives in its build layer,
not the language.

Unit 6b is therefore resequenced ahead of unit 7 so the benchmark
puzzles share their tree-hash helpers instead of pasting them four
times, and unit 7's style constraint is widened to admit the new
surfaces. assign stays held on unit 7 evidence with a pre-registered
trigger, and the compiled-sibling import stays deferred.

Decision by Evan, 2026-08-16, skeleton change under ground rule 6.
chia-gaming and tibetswap back the unit 6b census, and the script
now clones them so the survey is reproducible from a fresh checkout.
@EvanWinget
EvanWinget merged commit ed6be57 into main Aug 16, 2026
2 checks passed
@EvanWinget
EvanWinget deleted the unit-6b-scope-expansion branch August 16, 2026 23:22
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