Skip to content

Commit 85e6a9d

Browse files
committed
docs(design): 记录这一批的两个决定 —— register 规则没有被执行,以及扩展模型没有拥有者
§14:register 规则写了却没被执行。检查脚本有两处独立缺陷,各是一种已记录的形态 —— 谓词测的是标记(`?`)而不是性质(疑问词),对象集合按语法枚举(以 `#` 开头的行) 而列头同样是标题。补上之后全树报出 100 处标题 + 57 处列头。连带发现结构检查第 9 条 把链接的 fragment 丢掉,于是指向已改名小节的链接解析到文件就算通过。并写下 R5: 背景一节的范围由问题决定,不由方案决定。 §15:扩展模型没有拥有者。第 30 与第 31 章之间有全部原语,却没有一节陈述这个模型 本身。第 31 章现在从它开始,而边界是实测的而不是断言的。示例 12 先要变成真的 才承载得起它 —— 语言、编译器、以及它量到的那条 tool store 边界。
1 parent 25f5f39 commit 85e6a9d

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

.agents/docs/2026-09-08-the-documentation-as-a-book.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,3 +538,97 @@ question and exclusions; on the front door that block reads as machinery. `00`
538538
has no "not here" to declare because everything else *is* elsewhere, which its
539539
closing paragraph says in a sentence instead. Rule 11 exempts `00` by name, with
540540
that reason in the script.
541+
542+
## 14. The register rules were written and then not enforced
543+
544+
The user read chapter 00 and named three things: `背景:模块到了,工具链没跟上`,
545+
`谁在为这个落差付账`, and the table header `大致相当于谁的活`. All three are
546+
colloquial, all three violate §四 of the skill, and all three passed
547+
`check_docs_style.sh`.
548+
549+
Two independent defects in one check, and each is a form recorded elsewhere:
550+
551+
**The predicate tested a marker rather than the property.** It matched `?`, 吗
552+
and 呢 — the punctuation a question usually carries. The property is the
553+
interrogative *word*, and neither `谁在为这个落差付账` nor `打什么由谁决定`
554+
carries the marker. The predicate is now the word set 谁 / 哪 / 什么 / 多少 /
555+
为何 / 如何 / 怎样 / 怎么.
556+
557+
**The object set was enumerated syntactically.** It read lines beginning with
558+
`#`. The property a heading has — it names a topic, it is read out of order, it
559+
is what a reader scans — is held equally by a table's header cells, which were
560+
therefore never examined. Rule 4 adds them: the row above a `|---|---|`
561+
separator, cell by cell.
562+
563+
Extending both reported 100 headings and 57 header cells across 20 chapters,
564+
in both languages. They are now noun phrases. The rename table is in the commit
565+
rather than here, because it is a list of 157 strings and not a decision.
566+
567+
**One consequence was not obvious.** Renaming 100 headings invalidates any link
568+
that names a section by its anchor, and rule 9 of `check_docs_structure.sh`
569+
discarded the fragment (`(?:#[^)]*)?`) — a link to a renamed section resolved to
570+
the file and passed. It now computes GitHub's slug, including the `-1` / `-2`
571+
suffix for repeated headings, and verifies the fragment. It immediately reported
572+
two anchors in chapter 30 that had been wrong since they were written, before
573+
any rename.
574+
575+
### The rule that generalises
576+
577+
R5 in the skill: **the scope of a background section is decided by the problem,
578+
not by the tool.** Chapter 00's background was about modules, which is the part
579+
of the problem mcpp is closest to. The problem a reader actually has is that a
580+
C++ project needs four things at once — a build description, dependencies, a
581+
compiler new enough, and an environment the result runs in — and no single tool
582+
owns all four. CMake is the de facto standard for the first, and a de facto
583+
standard is a statement about adoption rather than about the experience of use.
584+
The environment is the layer that fails most often because it is the only one
585+
nothing checks. Modules are the fourth constraint on that structure, not the
586+
structure.
587+
588+
## 15. The extension model had no owner, and the example that shows it was a toy
589+
590+
The user asked where the plugin system is documented, and whether it reaches
591+
preprocessing and languages of one's own. The tree had chapter 30 (build
592+
programs) and chapter 31 (rule packages), and between them every primitive —
593+
but no section stating the model: what the extension points are, what the
594+
ecosystem has built from them, and where the boundary is. R1 says a topic has
595+
exactly one owner, and this one had none.
596+
597+
Chapter 31 now opens with it: five extension points with their effect and where
598+
each is declared; seven things the ecosystem has built from them; three shapes
599+
the model expresses (a new language whatever compiles it, preprocessing and
600+
code generation, and a file that is partly C++ and partly another language);
601+
and the boundary, which is measured rather than asserted —
602+
603+
- a dependency's `device_extensions` is consulted *after* the built-in roles,
604+
so a rule package cannot claim `.cpp`. Adding `".cpp"` to a rule's list is
605+
not diagnosed and has no effect, measured;
606+
- module-interface extensions are `[build] module_extensions`, a project axis,
607+
because a module interface is scanned, produces a BMI and joins the link —
608+
three engine behaviours rather than a command;
609+
- an extension in neither table is refused by name, quoted from the run.
610+
611+
### The example had to become real before it could carry this
612+
613+
`examples/12-a-new-device-language` had a `.toy` that was "one integer per line,
614+
and the entry point returns their sum", compiled by a shell script. It
615+
demonstrated the two manifest keys and nothing else, and it was not a shape any
616+
ecosystem author meets.
617+
618+
`.toy` now has `let`, assignment, `if`/`else`, `while`, calls between kernels,
619+
and the arithmetic and comparison operators. Its compiler is an ordinary mcpp
620+
package — lexer, recursive-descent parser, semantic checks, C++ emitter — built
621+
**for the build machine** through `tools = ["toyc"]` + `reexport = true` and
622+
reached with `mcpp::dep_bin`. That makes it the tree's first example of a
623+
dependency producing a host tool, a capability that until now existed only in
624+
prose.
625+
626+
**And it measured a boundary the documentation did not state.** The tool store's
627+
key is the tool package's identity, version, host triple, compiler identity,
628+
profile, features and the versions of its transitive dependencies. It holds no
629+
source content, so editing a `path` tool's sources without changing its version
630+
leaves the cached binary in place: `mcpp run` reported `Finished dev in 0.00s`
631+
and printed the previous answer. Chapter 30 now states it, with the two ways
632+
out. The action itself is not the gap — the rule declares the compiler binary
633+
as an input, so a changed binary dirties the edge. What does not happen is the
634+
rebuild that would change those bytes.

0 commit comments

Comments
 (0)