A File That Explains Its Own Entries
On paper, a records office writes on the folder itself: the reference, the office it came from, the date after which it may be destroyed. Scan the folder and that writing has nowhere left to go. Write it inside the file instead and something worse happens — the file quietly stops obeying the archiving rules it says it obeys, and the day somebody checks it, it comes back refused.
Every archiving rule knows a title and an author; a keep-until date belongs to you. So this file carries those entries and, beside each one, a description of it: what it is called, how it is to be read, who it is written for, what it means. That description is what a checker looks for first, and what it accepts information nobody but you invented on. The first page prints the very same five entries as the record hidden inside — a reference, a department, a date in 2056, a classification and a sheet count — so what a person reads and what a machine reads cannot drift apart. A second page shows the other kinds of entry such a description can announce — a yes or no, a type of file, a person's name, a measurement, an address on the web — on a loan record, and gives that page a hidden record of its own, apart from the document's.
An entry can also hold a list, in order or not, or a record with named fields: here the witnesses to the loan, and every time the folder changed hands, each with its date and who took it. The description sets out that record field by field, so a checker reads it as it reads the rest.
What This Example Shows
- Five entries a records office invented, among them a date in 2056 before which nothing may be destroyed.
- Each entry arriving with a description of itself, which is what a checker accepts it on.
- The page and the hidden record printed from one list, so they cannot disagree.
- Lists and records with named fields, described for the checker like any other entry.
The Source Code, Complete
Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library.
The third is the description itself: a plain list of what the page has to say, which is what the service is sent.
Read the Rust source
Read the Python source
Read the JSON source
The Document Itself
Open the document in English
Open the document in French
Open the document in German
Open the document in Spanish
Open the document in Italian
Open the document in Portuguese