Skip to content

Commit 7ba7073

Browse files
committed
docs: chapter 00 earns its definition, and the install section recommends one way
Two corrections from review, and both are about what a reader meets first. CHAPTER 00 IS RESTRUCTURED. It opened with a metadata block -- reader, question, exclusions -- which is a reference-chapter device and reads as machinery on the front door. And it stated what mcpp is before saying what problem that answers. It now runs background -> who pays -> what mcpp is -> the guarantee -> the smallest example that shows it: C++20 gave the language modules, and adopting them turned out to be a build-system problem: scan for `import`, order the compiles, cache and invalidate the interfaces, with a compiler new enough to have the feature -- and `import std` needs the standard library's own module built first. The gap is concrete: this machine's g++ is 13.3.0 and cannot compile it. A person pays an afternoon per machine. An agent pays context, in three places before it writes a line: reading the build system, reconstructing the environment it assumes, and following a header through its transitive includes to find what is declared. Modules remove the third; mcpp removes the other two. Rule 11 exempts `00` by name, with that reason in the script: it has no "not here" to declare because everything else IS elsewhere, which its closing paragraph says in a sentence. THE INSTALL SECTION FOLLOWS R5. `xlings install mcpp -y` is the recommended way and is the only one in the body. The standalone curl script and the per-host default-toolchain table fold into a `<details>` -- they were offered at equal weight, which asks a first-time reader to choose between two installs before they have any basis to.
1 parent c248ad0 commit 7ba7073

6 files changed

Lines changed: 166 additions & 99 deletions

File tree

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,10 @@ The design failed two of its own rules to get there:
475475
- **R7** — an advantage is shown by the artifact, not by the mechanism. A model
476476
chapter explains how the advantage is produced and never demonstrates it.
477477

478-
`00 — What mcpp Is` replaces it:
478+
`00 — What mcpp Is` replaces it, and its shape came from the review too:
479+
**background → who pays → what mcpp is → the guarantee → the smallest example
480+
that shows it.** A first chapter earns the definition by first stating the
481+
problem, and only then shows it solved.
479482

480483
1. **The definition**, in the form the reviewer gave: mcpp = build system +
481484
build plugins + package manager + toolchain management + the environment and
@@ -508,3 +511,9 @@ chapter and it still produced the wrong chapter, because the cell that decides
508511
everything — the reader — was answered with "anyone" and then served as if that
509512
meant "someone who wants the model". A reader cell that names no task is not
510513
filled in.
514+
515+
**And the opening block came off.** Every other chapter opens with reader,
516+
question and exclusions; on the front door that block reads as machinery. `00`
517+
has no "not here" to declare because everything else *is* elsewhere, which its
518+
closing paragraph says in a sentence instead. Rule 11 exempts `00` by name, with
519+
that reason in the script.

.github/tools/check_docs_structure.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,12 @@ PYPARITY
211211
# half -- they are the gate that stops a chapter re-absorbing a topic another
212212
# chapter owns. Five of 24 chapters had this before the design; a rule nothing
213213
# checks is a rule that decays back to five.
214+
# Chapter 00 is exempt: it is the book's front door, and a metadata block is a
215+
# reference-chapter device. It has no "not here" to declare, because everything
216+
# else IS elsewhere -- which is what its closing paragraph says instead.
214217
for f in docs/[0-9]*.md docs/zh/[0-9]*.md; do
215218
[ -f "$f" ] || continue
219+
case "$(basename "$f")" in 00-*) continue ;; esac
216220
head -18 "$f" | grep -qE '^\*\*(Reader|读者)' \
217221
|| bad "$f: no designed opening — the first lines must name the reader"
218222
head -18 "$f" | grep -qE '(question this chapter answers|本章回答的那一个问题)' \

docs/00-what-mcpp-is.md

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
11
# 00 — What mcpp Is
22

3-
**Reader:** anyone, before anything else.
3+
## The background: modules arrived, and the tooling did not
44

5-
**The question this chapter answers:** what is mcpp, what does it do for a
6-
project, and what does it cost to try.
5+
C++20 gave the language modules. They change what a translation unit costs: an
6+
interface is declared once and imported, instead of being re-parsed out of
7+
headers by every file that needs it, and what a consumer sees is what the author
8+
exported rather than everything the header happened to include.
79

8-
**Not here:** how any of it works internally, and every field and flag. This
9-
chapter ends with a session that has been run; the chapters after it are the
10-
reference.
10+
Adopting them turned out to be a build-system problem rather than a language
11+
one. A build has to scan sources for `import`, order the compiles accordingly,
12+
cache the compiled interfaces and invalidate them correctly — with a compiler
13+
new enough to have the feature at all. `import std` adds one more: the standard
14+
library's own module has to be built before anything can use it.
1115

12-
## Five things in one program
16+
The gap is concrete rather than theoretical. On the machine this chapter was
17+
written on:
18+
19+
```console
20+
$ g++ --version
21+
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
22+
```
23+
24+
That compiler cannot compile `import std`. Nothing about the project is wrong;
25+
the machine is simply not the machine the project needs.
26+
27+
## Who pays for that gap
28+
29+
**A person pays an afternoon**, once per machine and once per new contributor:
30+
install a newer compiler, work out which build-system flags turn modules on,
31+
find the dependencies, and then work out which of the three broke when it does
32+
not link.
33+
34+
**An agent pays context**, in three places before it writes a line of code:
35+
reading the build system to learn what it does, reconstructing the environment
36+
it assumes, and following a header through its transitive includes to find out
37+
what is actually declared.
38+
39+
Modules remove the third — an interface is explicit, and `import` says exactly
40+
what is used. mcpp exists to remove the other two, and to make the first work
41+
without the afternoon.
42+
43+
## What mcpp is
1344

1445
```
1546
mcpp = build system
@@ -20,9 +51,9 @@ mcpp = build system
2051
```
2152

2253
Most C++ projects assemble those five from separate tools, and the seams between
23-
them are where a new contributor loses an afternoon: the build file assumes a
24-
compiler the machine does not have, the package manager assumes a build file it
25-
did not write, and the environment is a paragraph in a README.
54+
them are where the afternoon goes: the build file assumes a compiler the machine
55+
does not have, the package manager assumes a build file it did not write, and
56+
the environment is a paragraph in a README.
2657

2758
mcpp is one program, so there are no seams to assemble.
2859

@@ -38,36 +69,30 @@ For a reader who already has tools for these jobs, the parts land roughly here:
3869

3970
**The closest single-tool analogues are Cargo and Zig**, and for different
4071
halves of the same idea. Cargo is one program that is the build, the packages,
41-
the lock file and the test runner, so a Rust project is cloned and built without
42-
a preliminary step — that is the guarantee below, in another language. Zig ships
43-
its toolchain with the tool and cross-compiles by default, so the compiler is
44-
not something the machine has to already have — that is the toolchain row.
72+
the lock file and the test runner, so a Rust project is cloned and built with no
73+
preliminary step. Zig ships its toolchain with the tool and cross-compiles by
74+
default, so the compiler is not something the machine must already have.
4575

4676
mcpp is that shape for C++, with one part neither of them has: the environment
4777
layer, which is why a project can also declare the *non-compiler* tools its
4878
build needs.
4979

5080
**The table places the parts; it does not claim equivalence.** Each of those
5181
tools does more in its own area than mcpp does, and a project that needs that
52-
depth should use it. What the row is saying is which familiar job the part
53-
corresponds to, so the rest of this documentation has somewhere to attach.
82+
depth should use it.
5483

5584
## The guarantee
5685

5786
> **Clone any mcpp project and `mcpp build` works** — without installing a
5887
> compiler, configuring an environment, or hunting down dependencies.
5988
60-
That is the whole claim, and everything below is it being demonstrated rather
61-
than repeated.
62-
6389
Two boundaries, stated here so the claim can be trusted: a project that targets
6490
a device still downloads that device's toolkit the first time, and a target this
6591
machine cannot serve is refused by name rather than built wrongly.
6692

67-
## A first session, end to end
93+
## The smallest example that shows it
6894

69-
Run on a machine whose only C++ compiler is GCC 13, which cannot compile
70-
`import std`.
95+
On the same machine, whose only C++ compiler is the GCC 13 above.
7196

7297
```console
7398
$ mcpp new hello
@@ -77,14 +102,6 @@ Next: cd hello && mcpp build && mcpp run (or `mcpp test`)
77102

78103
Four files, and the manifest is five lines:
79104

80-
```
81-
hello/
82-
├── mcpp.toml
83-
├── src/main.cpp
84-
├── tests/test_smoke.cpp
85-
└── .gitignore
86-
```
87-
88105
```toml
89106
[package]
90107
name = "hello"
@@ -93,8 +110,9 @@ description = "A modular C++23 package"
93110
license = "Apache-2.0"
94111
```
95112

96-
**No compiler, no language standard and no dependency is declared**, and the
97-
source uses a feature the machine's own compiler does not have:
113+
**No compiler, no language standard and no dependency is declared** — that is
114+
the whole of what a reader has to understand before changing this project. The
115+
source uses the feature the machine's compiler does not have:
98116

99117
```cpp
100118
import std;
@@ -115,21 +133,16 @@ Hello from hello!
115133
Built with import std + std::println on modular C++23.
116134
```
117135

118-
1.25 seconds of wall clock, first run included.
119-
120-
The compiler that did it is not the one on the machine:
136+
1.25 seconds of wall clock, first run included. The compiler that did it:
121137

122138
```console
123-
$ g++ --version
124-
g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
125-
126139
$ mcpp self env
127140
default toolchain = gcc@16.1.0
128141
```
129142

130143
mcpp installed GCC 16 and used it. Nothing on the host was changed, and a
131-
colleague who clones this project gets the same compiler rather than the one
132-
their distribution happens to ship.
144+
colleague — or an agent — cloning this project gets the same compiler rather
145+
than the one their machine happens to ship.
133146

134147
**A dependency is one line and needs no other step:**
135148

@@ -164,3 +177,7 @@ that wants one of them does not leave the tool to get it.
164177
| put a program on the screen | [01 — Getting Started](01-getting-started.md) |
165178
| decide whether mcpp fits the work at hand | [02 — Scenarios](02-scenarios.md) |
166179
| read a project of the same shape | [03 — Examples](03-examples.md) |
180+
181+
Everything after this chapter is reference: what a manifest may say, how
182+
dependencies resolve, how a target is named. This one states no field and no
183+
flag on purpose.

docs/01-getting-started.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,43 @@ than repeats — and every field a manifest may hold, which is
1414
1515
## Installation
1616

17-
Supported hosts are Linux x86_64 / aarch64, macOS ARM64, and Windows x86_64. You do not need to install GCC, xlings, or any other build dependency beforehand.
18-
On its first run, mcpp installs a default toolchain into an isolated sandbox (`~/.mcpp/`). The choice is host-aware: Linux x86_64 uses `gcc@16.1.0`; other Linux architectures use `gcc@15.1.0-musl`; macOS uses `llvm@20.1.7`; Windows uses `llvm@20.1.7` when usable MSVC is available and otherwise uses `gcc@16.1.0` for `x86_64-windows-gnu`.
17+
Supported hosts are Linux x86_64 / aarch64, macOS ARM64, and Windows x86_64.
18+
GCC, xlings and every other build dependency are installed by mcpp; none of them
19+
has to be there first.
1920

20-
We recommend installing via [xlings](https://xlings.d2learn.org), which keeps mcpp isolated from your system environment:
21+
**The recommended way is [xlings](https://xlings.d2learn.org)**, which keeps
22+
mcpp isolated from the system environment:
2123

2224
```bash
2325
xlings install mcpp -y
2426
```
2527

26-
Alternatively, on Linux x86_64/aarch64 or macOS ARM64, use the one-line
27-
installer script (xlings is bundled, and everything is installed under
28-
`~/.mcpp/`):
28+
<details>
29+
<summary>Other ways: the standalone script, and what the first run installs</summary>
30+
31+
On Linux x86_64/aarch64 or macOS ARM64 a one-line installer bundles xlings and
32+
puts everything under `~/.mcpp/`. It does not support Windows, where the
33+
PowerShell xlings command in the README is the way in.
2934

3035
```bash
3136
curl -fsSL https://github.com/mcpp-community/mcpp/releases/latest/download/install.sh | bash
3237
```
3338

34-
The script does not support Windows; install through the PowerShell xlings
35-
command in the README instead.
39+
On its first run mcpp installs a default toolchain into `~/.mcpp/`, chosen for
40+
the host:
41+
42+
| host | default |
43+
|---|---|
44+
| Linux x86_64 | `gcc@16.1.0` |
45+
| other Linux architectures | `gcc@15.1.0-musl` |
46+
| macOS | `llvm@20.1.7` |
47+
| Windows with usable MSVC | `llvm@20.1.7` |
48+
| Windows without it | `gcc@16.1.0` for `x86_64-windows-gnu` |
49+
50+
Full installation instructions, including Windows, are in the
51+
["Installation" section of the README](../README.md#install).
3652

37-
For full installation instructions (including xlings install commands, Windows support, and more), see the ["Installation" section of the README](../README.md#install).
53+
</details>
3854

3955
Once installation is complete, start a new shell session, then verify:
4056

0 commit comments

Comments
 (0)