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.
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | commented throughout, most of all where it is obscure or needs a |
| 70 | 70 | compiler writer's knowledge; at least 400,000 lines of raz a second; |
| 71 | 71 | the report, `doc/raz.md`, under 40 pages as `make pdf` renders it, |
| 72 | - checked by hand after each milestone (30 at report 2026-10.31). | |
| 72 | + checked by hand after each milestone (31 at report 2026-10.32). | |
| 73 | 73 | - Clarity comes first, before speed and size: the compiler must be a |
| 74 | 74 | model of plain code that a beginner can follow. Every rewrite of the |
| 75 | 75 | code it makes is explained where it is done, with the code before |
| @@ -90,7 +90,9 @@ | ||
| 90 | 90 | compiler in raz, built by itself (Self, done); the seed in `seed/` is |
| 91 | 91 | frozen, and v0.9.1 was the last release it built. The compiler takes |
| 92 | 92 | 1.4 times the Pascal one's time; `make kernels` measures `test/bench` |
| 93 | -against FPC `-O2`. Next: what the owner chooses. What | |
| 93 | +against FPC `-O2`. Since then, not yet released: report 2026-10.32, | |
| 94 | +the eighth thaw (a constant typed `[]T` may be `[]`), with `Vec.pop` | |
| 95 | +and `Sys.Info.links`. Next: what the owner chooses. What | |
| 94 | 96 | each version of the report changed is in `doc/report-history.md`, and |
| 95 | 97 | what each step did is in git; don't repeat it here. |
| 96 | 98 | |
| @@ -225,6 +227,10 @@ | ||
| 225 | 227 | local slice variable or a record, stored, or come back from a call, |
| 226 | 228 | isn't, and is left undefined (10). `ret` and `keep`, in |
| 227 | 229 | PROPOSALS.md, would close it; the owner keeps it open for now. |
| 230 | +- An empty slice constant, `const E: []T = [];` (report 2026-10.32), | |
| 231 | + is 16 zero bytes in read-only data, read as an array constant is; | |
| 232 | + `LEN` of it is no constant. A constant's slice part takes `[]`, and | |
| 233 | + names a constant whole, of any module, by its type, not its text. | |
| 228 | 234 | - An array a call returns is a temporary of the statement (report |
| 229 | 235 | 2026-10.28, 8): a slice of it kept past the statement is undefined |
| 230 | 236 | (10), and isn't caught. |
| @@ -360,9 +360,9 @@ | ||
| 360 | 360 | program following links finds that one has led it back into a |
| 361 | 361 | directory it is already in. `Info.links` is how many names the file |
| 362 | 362 | has: more than 1 if a hard link shares it, so that writing to it |
| 363 | -writes to a file named elsewhere too; 0 on a target that doesn't say. `Info.mode` holds the nine | |
| 364 | -bits of `rwxrwxrwx`, and `chmod` sets them, 1EDH (755) for a program, | |
| 365 | -1A4H (644) for data. | |
| 363 | +writes to a file named elsewhere too; 0 on a target that doesn't say. | |
| 364 | +`Info.mode` holds the nine bits of `rwxrwxrwx`, and `chmod` sets them, | |
| 365 | +1EDH (755) for a program, 1A4H (644) for data. | |
| 366 | 366 | |
| 367 | 367 | **Programs.** `openPty` makes a pseudo-terminal, a terminal that a |
| 368 | 368 | program, a terminal emulator, plays the screen and the keyboard of: |
| @@ -637,7 +637,7 @@ | ||
| 637 | 637 | proc init*(v: ^Vec; a: ^Mem.Allocator); |
| 638 | 638 | proc room*(v: ^Vec; n: INT): BOOL; (* room for n more; false if the allocator has none *) |
| 639 | 639 | proc push*(v: ^Vec; x: T); (* x added at the end *) |
| 640 | -proc pop*(v: ^Vec): (T, BOOL); (* the last element, taken off; false if empty *) | |
| 640 | +proc pop*(v: ^Vec): (T, BOOL); (* the last element, taken off; false if the array is empty *) | |
| 641 | 641 | proc add*(v: ^Vec): ^T; (* a new element at the end, zero, to fill in place *) |
| 642 | 642 | proc tryPush*(v: ^Vec; x: T): BOOL; (* push; false, and v as it was, if there is no room *) |
| 643 | 643 | proc tryAdd*(v: ^Vec): (^T, BOOL); (* add; nil and false, and v as it was, if there is no room *) |
| @@ -683,8 +683,7 @@ | ||
| 683 | 683 | long it grows. `all` gives the elements as a slice, indexed and |
| 684 | 684 | checked as any is, and `v.len` is their number; the slice, and what |
| 685 | 685 | `add` gives, are good until the array next grows. `pop` takes the last |
| 686 | -element off, keeping the memory. `push`, `add` and | |
| 687 | -`resize` stop the program, as `Buf.add` does, if the allocator has no | |
| 686 | +element off, keeping the memory. `push`, `add` and `resize` stop the program, as `Buf.add` does, if the allocator has no | |
| 688 | 687 | room; `room` asks first: `import Lines := Vec([]U8);`. `Fmt`'s format takes the next argument at each |
| 689 | 688 | `{}`; `{{` and `}}` stand for `{` and `}`. A `Map` hashes and |
| 690 | 689 | compares its keys with the procedures it is given: |
| @@ -407,7 +407,7 @@ | ||
| 407 | 407 | |
| 408 | 408 | ``` |
| 409 | 409 | const Wide: [][2]I32 = [[1100H, 115FH], [2E80H, 303EH], [0AC00H, 0D7A3H]]; |
| 410 | - Count = LEN(Wide); (* 3, a constant *) | |
| 410 | + Count = LEN(Wide); (* 3, a constant *) | |
| 411 | 411 | Narrow: [][2]I32 = []; (* the empty slice *) |
| 412 | 412 | ``` |
| 413 | 413 |
| @@ -195,6 +195,6 @@ | ||
| 195 | 195 | literal is `[]` is the empty slice, a value of type `[]T`, and no |
| 196 | 196 | array; `LEN` of it is 0, not a constant. A slice part of a constant |
| 197 | 197 | may be the empty slice, by `[]` or by such a constant's name (section |
| 198 | - 4). Before, both were errors, since an array has at least one element. It breaks no | |
| 199 | - program. `Sys.Info` gains `links`, how many names a file has | |
| 200 | - (volume 2). | |
| 198 | + 4). Before, both were errors, since an array has at least one | |
| 199 | + element. It breaks no program. `Vec` gains `pop`, and `Sys.Info` | |
| 200 | + `links`, how many names a file has (volume 2). |
| @@ -9,6 +9,8 @@ | ||
| 9 | 9 | pre, code { font-family: "DejaVu Sans Mono", monospace; font-size: 8.8pt; } |
| 10 | 10 | /* a block of code or grammar is never split across pages */ |
| 11 | 11 | pre { background: #f6f6f3; padding: 6px 9px; border-left: 2px solid #bbb; break-inside: avoid; white-space: pre-wrap; } |
| 12 | +/* and stays on the page of the paragraph that leads to it */ | |
| 13 | +p:has(+ div.sourceCode, + pre) { break-after: avoid; } | |
| 12 | 14 | table { border-collapse: collapse; font-size: 9.5pt; } |
| 13 | 15 | td, th { border-bottom: 1px solid #ddd; padding: 2px 8px; text-align: left; } |
| 14 | 16 | nav#TOC { break-after: page; } |