From c6872e07137a4647f8d22096def7ae8bd4ad3441 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Fri, 16 Oct 2026 15:31:44 +0100 Subject: [PATCH] Docs: 2026-10.32 told whole; an example kept with its paragraph report-history names Vec.pop; raz-lib reflowed where links and pop went in; report.css keeps a paragraph on the page of the code it leads to (31 pages, 22 for volume 2); CLAUDE.md: where things stand, the reading of the empty slice constant. --- diff --git a/CLAUDE.md b/CLAUDE.md index b50d75d..db84d64 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -69,7 +69,7 @@ commented throughout, most of all where it is obscure or needs a compiler writer's knowledge; at least 400,000 lines of raz a second; the report, `doc/raz.md`, under 40 pages as `make pdf` renders it, - checked by hand after each milestone (30 at report 2026-10.31). + checked by hand after each milestone (31 at report 2026-10.32). - Clarity comes first, before speed and size: the compiler must be a model of plain code that a beginner can follow. Every rewrite of the code it makes is explained where it is done, with the code before @@ -90,7 +90,9 @@ compiler in raz, built by itself (Self, done); the seed in `seed/` is frozen, and v0.9.1 was the last release it built. The compiler takes 1.4 times the Pascal one's time; `make kernels` measures `test/bench` -against FPC `-O2`. Next: what the owner chooses. What +against FPC `-O2`. Since then, not yet released: report 2026-10.32, +the eighth thaw (a constant typed `[]T` may be `[]`), with `Vec.pop` +and `Sys.Info.links`. Next: what the owner chooses. What each version of the report changed is in `doc/report-history.md`, and what each step did is in git; don't repeat it here. @@ -225,6 +227,10 @@ local slice variable or a record, stored, or come back from a call, isn't, and is left undefined (10). `ret` and `keep`, in PROPOSALS.md, would close it; the owner keeps it open for now. +- An empty slice constant, `const E: []T = [];` (report 2026-10.32), + is 16 zero bytes in read-only data, read as an array constant is; + `LEN` of it is no constant. A constant's slice part takes `[]`, and + names a constant whole, of any module, by its type, not its text. - An array a call returns is a temporary of the statement (report 2026-10.28, 8): a slice of it kept past the statement is undefined (10), and isn't caught. diff --git a/doc/raz-lib.md b/doc/raz-lib.md index aafeef0..0fac695 100644 --- a/doc/raz-lib.md +++ b/doc/raz-lib.md @@ -360,9 +360,9 @@ program following links finds that one has led it back into a directory it is already in. `Info.links` is how many names the file has: more than 1 if a hard link shares it, so that writing to it -writes to a file named elsewhere too; 0 on a target that doesn't say. `Info.mode` holds the nine -bits of `rwxrwxrwx`, and `chmod` sets them, 1EDH (755) for a program, -1A4H (644) for data. +writes to a file named elsewhere too; 0 on a target that doesn't say. +`Info.mode` holds the nine bits of `rwxrwxrwx`, and `chmod` sets them, +1EDH (755) for a program, 1A4H (644) for data. **Programs.** `openPty` makes a pseudo-terminal, a terminal that a program, a terminal emulator, plays the screen and the keyboard of: @@ -637,7 +637,7 @@ proc init*(v: ^Vec; a: ^Mem.Allocator); proc room*(v: ^Vec; n: INT): BOOL; (* room for n more; false if the allocator has none *) proc push*(v: ^Vec; x: T); (* x added at the end *) -proc pop*(v: ^Vec): (T, BOOL); (* the last element, taken off; false if empty *) +proc pop*(v: ^Vec): (T, BOOL); (* the last element, taken off; false if the array is empty *) proc add*(v: ^Vec): ^T; (* a new element at the end, zero, to fill in place *) proc tryPush*(v: ^Vec; x: T): BOOL; (* push; false, and v as it was, if there is no room *) proc tryAdd*(v: ^Vec): (^T, BOOL); (* add; nil and false, and v as it was, if there is no room *) @@ -683,8 +683,7 @@ long it grows. `all` gives the elements as a slice, indexed and checked as any is, and `v.len` is their number; the slice, and what `add` gives, are good until the array next grows. `pop` takes the last -element off, keeping the memory. `push`, `add` and -`resize` stop the program, as `Buf.add` does, if the allocator has no +element off, keeping the memory. `push`, `add` and `resize` stop the program, as `Buf.add` does, if the allocator has no room; `room` asks first: `import Lines := Vec([]U8);`. `Fmt`'s format takes the next argument at each `{}`; `{{` and `}}` stand for `{` and `}`. A `Map` hashes and compares its keys with the procedures it is given: diff --git a/doc/raz.md b/doc/raz.md index 90da50e..3999b5f 100644 --- a/doc/raz.md +++ b/doc/raz.md @@ -407,7 +407,7 @@ ``` const Wide: [][2]I32 = [[1100H, 115FH], [2E80H, 303EH], [0AC00H, 0D7A3H]]; - Count = LEN(Wide); (* 3, a constant *) + Count = LEN(Wide); (* 3, a constant *) Narrow: [][2]I32 = []; (* the empty slice *) ``` diff --git a/doc/report-history.md b/doc/report-history.md index e950c5a..ae894f6 100644 --- a/doc/report-history.md +++ b/doc/report-history.md @@ -195,6 +195,6 @@ literal is `[]` is the empty slice, a value of type `[]T`, and no array; `LEN` of it is 0, not a constant. A slice part of a constant may be the empty slice, by `[]` or by such a constant's name (section - 4). Before, both were errors, since an array has at least one element. It breaks no - program. `Sys.Info` gains `links`, how many names a file has - (volume 2). + 4). Before, both were errors, since an array has at least one + element. It breaks no program. `Vec` gains `pop`, and `Sys.Info` + `links`, how many names a file has (volume 2). diff --git a/doc/report.css b/doc/report.css index 129d0af..eb1f752 100644 --- a/doc/report.css +++ b/doc/report.css @@ -9,6 +9,8 @@ pre, code { font-family: "DejaVu Sans Mono", monospace; font-size: 8.8pt; } /* a block of code or grammar is never split across pages */ pre { background: #f6f6f3; padding: 6px 9px; border-left: 2px solid #bbb; break-inside: avoid; white-space: pre-wrap; } +/* and stays on the page of the paragraph that leads to it */ +p:has(+ div.sourceCode, + pre) { break-after: avoid; } table { border-collapse: collapse; font-size: 9.5pt; } td, th { border-bottom: 1px solid #ddd; padding: 2px 8px; text-align: left; } nav#TOC { break-after: page; }