| | @@ -27,21 +27,62 @@ |
| 27 | 27 | |
| 28 | 28 | ## 2. The safety thaw: v0.23.0 |
| 29 | 29 | |
| 30 | | -From `MEM_PROPOSAL.md`, with "Less that is undefined", "A slice that |
| 31 | | -can't be written: `[]const T`", "What a call does with its arguments" |
| 32 | | -(its part 3, `ret` and `keep`), and "Left out"'s exported array read as |
| 33 | | -a slice. |
| 30 | +The scope, by the owner's word of 2026-10-26, after reviewing |
| 31 | +`MEM_PROPOSAL.md` whole with its appendices. raz doesn't promise memory |
| 32 | +safety: `free` stays, so a program can always keep a pointer to what |
| 33 | +it freed. The thaw shrinks what is undefined, and fences what can reach |
| 34 | +memory it shouldn't, so a reader can find it. |
| 35 | + |
| 36 | +What goes in: |
| 37 | + |
| 38 | +- **An array a call returns lives to the end of its procedure** |
| 39 | + ("Less that is undefined", piece 1; the proposal's F.1). Its slot is |
| 40 | + reserved as a deferred statement's is. |
| 41 | +- **A race tears no slice, said**: 7.6 says a slice or variant read and |
| 42 | + written in a race is undefined (piece 3). Said, not prevented: no |
| 43 | + 16-byte moves. |
| 44 | +- **`[]const T`**, a slice whose elements can't be written; a `[]T` |
| 45 | + goes where one is wanted, never back. String literals are `[]const |
| 46 | + U8`, and a constant's slices `[]const T`, so writing them is an error |
| 47 | + (piece 2 drops out). `Str.trim`, `cut` and `field` take and return |
| 48 | + `[]const U8`. "Left out"'s exported array read as a slice comes with |
| 49 | + it. |
| 50 | +- **The fence, Oberon's way**: the unsafe operations are reached |
| 51 | + through a pseudo-module, `import SYSTEM`. `SYSTEM.ADR`, `SYSTEM.PTR`, |
| 52 | + `SYSTEM.SYSCALL`, `SYSTEM.ARGV`; pointer indexing, slicing and |
| 53 | + arithmetic, conversions to and from pointer and procedure types, |
| 54 | + views whose type holds a pointer, procedure or slice, `extern`, |
| 55 | + `link`, code procedures and `check off` are allowed only in a module |
| 56 | + that imports it. A warning for one release, so that `src/` can come |
| 57 | + to it once `BOOT` knows it, then an error. |
| 58 | +- **`CAS`, `XCHG` and `XADD` take a variable**, as `INC` does, not an |
| 59 | + address (the proposal's E.4), so atomics need no `SYSTEM`. |
| 60 | +- **Library**: `Heap`'s debugging mode (G: freed blocks poisoned and |
| 61 | + held back, guard bytes checked); `Task(T)`, a thread started with no |
| 62 | + cast; `Lock.Guarded(T)`, a value with its lock. |
| 63 | + |
| 64 | +What is left out, and why: `ret` and `keep` (B) and owners that count |
| 65 | +what they lend (C), too large for what they close without the rest; |
| 66 | +the heap without `free` (D), since `free` stays; atomic slices and the |
| 67 | +rest of threads (E), for programs that race only. With them the |
| 68 | +guarantee of the proposal's section 3. |
| 34 | 69 | |
| 35 | | -1. The owner chooses the scope. The proposal's parts stand alone: |
| 36 | | - A, the fence (`unsafe;`, which modules may reach memory they |
| 37 | | - shouldn't); B, lending (`ret` and `keep`, the returned-slice hole |
| 38 | | - closed); C, owners that count what they lend. Appendices 4 to 7 find |
| 39 | | - holes in its body, and C is much the largest. A then B, each a step |
| 40 | | - of its own, is the smaller way. |
| 41 | | -2. The body of what is chosen is revised against its appendices. |
| 42 | | -3. The report's text, for the owner to review; then the compiler, the |
| 43 | | - library, and the programs in `~/r` it breaks, each mended. |
| 44 | | -4. Release, and the report's pages checked. |
| 70 | +The survey of 2026-10-26 (the compiler counting each use, across |
| 71 | +`~/r`): about 8,000 fenced uses, 451 of 960 modules. 77% of the `ADR`s |
| 72 | +go to a pointer parameter only dereferenced, mended by `var` or |
| 73 | +`const`, as `STANDARDS.md` asks; what is left for `SYSTEM` is about |
| 74 | +3,000 uses, most in `lib/` (`Sys`, `Rt`, `Heap`, `Map`) and `src/` |
| 75 | +(`Scan`, `Link`, `Chunk`). All 31 atomics take `ADR`. |
| 76 | + |
| 77 | +1. The report's text, for the owner to review. |
| 78 | +2. `tools/Mutate.raz` taught the two rewrites: `ADR` at a parameter |
| 79 | + only dereferenced to `var` or `const`, and `SYSTEM.` where an |
| 80 | + address is kept. |
| 81 | +3. The compiler, a commit a piece; the library; the programs in `~/r` |
| 82 | + it breaks, each mended. |
| 83 | +4. Release, and the report's pages checked; then, a step of its own, |
| 84 | + `BOOT` moved, `src/` imports `SYSTEM`, and the warning becomes an |
| 85 | + error. |
| 45 | 86 | |
| 46 | 87 | ## 3. The Moss work: v0.24.0 |
| 47 | 88 | |