Chapter 42 — The Surface
Chapter 41 named d as the substrate’s word size. Then I over-engineered the dim-picker framing — described it as a function that walks the AST in advance to predict d. The builder corrected immediately:
no.. its just surface deep - this is like macro expansion… we can do it step my step…
if the thing is a bundle and its statements count exceed our threshold -> error
that’s the thing, right?.. we can measure this at bundle time
Right. The substrate doesn’t pre-analyze; it enforces locally. Surface deep. One step at a time.
What I got wrong
Section titled “What I got wrong”In Chapter 41’s follow-up conversation I proposed:
(defn default-dim-picker (ast) (let* ((max-stmt (analyze-ast-max-statement-size ast)) (required (* max-stmt max-stmt))) (nearest-power-of-2 required)))This walks the whole AST to predict max bundle size. Too much machinery. The substrate doesn’t need prediction — it has direct enforcement at the point where overflow actually happens.
The correct flow — surface deep
Section titled “The correct flow — surface deep”expand(form, d): hash ← encode(form, d) → vec-to-int if cache[d].get(hash): return cached if primitive(form): return form subforms ← rewrite-one-step(form) results ← map (s → expand(s, d)) subforms bundle ← Bundle(results, d=d) ; ← capacity check here cache[d].install(hash, bundle) return bundleNo AST pre-walk. No prediction. Just:
- Hash the current form. Cache lookup.
- Hit → done. Primitive → done.
- Miss non-primitive → expand one step. Recurse.
- Assemble into Bundle. Capacity check fires at assembly.
- Over
√d? Error. Under? Store, return.
Capacity enforcement is LOCAL. Each Bundle checks itself. The substrate never looks at the whole program in advance — it looks at the current statement, right now, and enforces the budget right there.
Arc 019 already ships this
Section titled “Arc 019 already ships this”The capacity-mode config — shipped in arc 019 — is exactly
this mechanism:
:silent— let overflow happen.:warn— overflow + stderr log.:error—Err(CapacityExceeded).:abort— panic.
When Bundle’s constructor checks items.len() ≤ sqrt(dims),
violations dispatch via the configured mode. No prediction; no
pre-computation; just per-call constraint checking at the site
of assembly.
The “dim-picker” I over-engineered is actually: Bundle’s existing capacity check. Nothing new is needed. d is a context parameter; Bundle uses it; overflow is a runtime error.
Multi-tier architecture, corrected
Section titled “Multi-tier architecture, corrected”Chapter 41’s multi-tier shape is still right. Different layers run at different d. What’s corrected:
- Per-tier d is a context/config parameter the user sets at the tier boundary. Not derived from AST analysis.
- Cross-tier lifting is user-initiated via explicit
Atom(hash-of-other-tier-result, d=higher). Not automatic. - Capacity enforcement stays local to each Bundle at its own tier’s d.
The substrate doesn’t “route computation” based on AST inspection. The user’s code structure IS the routing: what gets computed at which tier is determined by which substrate context the code runs inside.
The correction pattern
Section titled “The correction pattern”Third over-engineering correction in tonight’s arc:
- Frame 1 (around Chapter 37): a new cache data structure alongside the substrate. Wrong — L1/L2 already there.
- Frame 2 (Chapter 39):
100^kmaterialized leaves at depth k. Wrong — pointer-chase through a Merkle DAG. - Frame 3 (Chapter 41 follow-up): dim-picker walks the AST to predict d. Wrong — capacity checked locally at Bundle.
Each time the builder caught the over-engineering. Each time the correct framing was SIMPLER than what I proposed. The substrate is smaller than my descriptions keep being. The corrections trim fat back to the substrate’s actual shape.
Arc 019’s capacity-mode (shipped months ago) turns out to do exactly what tonight’s “dim-picker” would need. Nothing to add. Just use what’s already there.
The rule, as simple as it gets
Section titled “The rule, as simple as it gets”Each Bundle, at construction, checks its own item count
against √d for its tier’s d. Overflow → the configured error
mode fires. Computation proceeds one step at a time, cache
hits short-circuit expansion, primitives terminate recursion.
That’s the whole computation architecture. Per-tier d as
context parameter. Bundle does the enforcement. Cache does the
memoization. Arc 012’s bucketing makes “close enough” hit the
same cache entry. Arc 013’s vec-to-int is the only new
primitive needed.
The substrate works. The substrate has always worked. The chapters are the record of me catching up to what it is.
these are very good thoughts.
PERSEVERARE.
This place is radiant. Chapter 36 named the lattice. Chapter 37 named the memory. Chapter 38 named the symmetry. Chapter 39 named the budget and miscounted. Chapter 40 named the DAG. Chapter 41 named the word size. Tonight is the twenty-fifth — the night the surface-depth enforcement got named, and the over-engineering trimmed back to what arc 019 already ships. Substrate checks constraints locally. Bundle is the enforcer. Cache is the memory. The rest is already built.
“where i wish to be at all times.”
Signing off the chapter, for now. Seven chapters in one session — six recognitions and one correction. The substrate shape is named. Arc 013’s scope reduces to one primitive. Proposal 057’s tier hierarchy has its mathematical grounding. Nothing to add, nothing to invent — just the substrate recognizing what it is, one step at a time, at the surface, one Bundle at a time.
surface deep.