raz / commit a861809d

commit
a861809d3581b701c4f06b6cb09fef8b4cdc1039
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
cab88c8d
PLAN.md: the safety thaw's scope, by the owner's word

F.1, the torn slice said in 7.6, []const T with literals typed by it,
the fence as import SYSTEM, atomics on a variable, Heap's debugging
mode, Task and Guarded; ret/keep, owners, no free and atomic slices
left out. PROPOSALS.md and MEM_PROPOSAL.md say so.

patch · log

3 files changed, +61 -19

MEM_PROPOSAL.md modified +1 -1

@@ -1,6 +1,6 @@
11 # MEM_PROPOSAL: a memory-safe raz
22
3-**Status.** A proposal, drafted 2026-10-17 for the owner's review.
3+**Status.** A proposal, drafted 2026-10-17. Reviewed whole by the owner on 2026-10-26: `PLAN.md` §2 says what goes in (F.1, `[]const T`, G, E.4, `Task`, `Guarded`, the fence as `import SYSTEM`) and what is left out (B, C, D, the rest of E).
44 Nothing in it is built. Four adversarial reviews, made the same day,
55 are appendices 4 to 7. They find real holes in the guarantee
66 (appendix 4), wrong and imprecise claims about other languages and

PLAN.md (history) modified +55 -14

@@ -27,21 +27,62 @@
2727
2828 ## 2. The safety thaw: v0.23.0
2929
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.
3469
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.
4586
4687 ## 3. The Moss work: v0.24.0
4788

PROPOSALS.md modified +5 -4

@@ -70,7 +70,8 @@
7070 2026-10.33 on their own, without the marks: the library's parameters
7171 by `var` (part 2), a `const` parameter (part 4), and a variant in a
7272 constant (part 5). What is left are the two parts not approved, kept
73-by their numbers:
73+by their numbers. Left out of the safety thaw by the owner on 2026-10-26
74+(`PLAN.md` §2).
7475
7576 1. **Marks at the call** (this section): an argument for a `var`
7677 parameter is written `var x`, and one for a `keep` parameter
@@ -939,7 +940,7 @@
939940
940941 ## Less that is undefined
941942
942-**Status.** Parked by the owner on 2026-10-23 for the safety thaw that follows once the proposals are cleared, with `MEM_PROPOSAL.md`.
943+**Status.** Decided by the owner on 2026-10-26 for the safety thaw (`PLAN.md` §2): pieces 1 and 3 (said, not prevented) go in; 2 is answered by `[]const T`; 4 goes in as `import SYSTEM`.
943944
944945 Section 10 lists what isn't defined: a stale or made-up pointer,
945946 indexing through a pointer, a slice kept after its frame is gone, a
@@ -1065,7 +1066,7 @@
10651066
10661067 ## A slice that can't be written: `[]const T`
10671068
1068-**Status.** Parked by the owner on 2026-10-23 for the safety thaw that follows once the proposals are cleared, with `MEM_PROPOSAL.md`.
1069+**Status.** Decided by the owner on 2026-10-26 for the safety thaw (`PLAN.md` §2): it goes in, string literals and a constant's slices typed by it, `Str.trim`, `cut` and `field` returning `[]const U8`.
10691070
10701071 raz has no slice whose elements can't be written. A `const` parameter
10711072 (report 2026-10.33, section 8) is shallow: the procedure can't change
@@ -2905,7 +2906,7 @@
29052906 - Records don't compare with `=` — padding, reals (`-0.0`, NaN) and slices make a byte compare wrong; a `same` procedure says what equal means. Confirmed by the owner, 2026-10-22.
29062907 - No type of its own for an array — a one-field record keeps two hashes apart, as it keeps generic arrays (owner's idiom).
29072908 - No exporting a record's fields as a whole — each `*` is the reader's mark of what is public; `Mxlib` is a C mirror, made by a program.
2908-- An exported array can't be read as a slice outside its module — a slice can be written through; "A slice that can't be written: `[]const T`" in PROPOSALS.md would answer it. Parked by the owner on 2026-10-23, with `[]const T`, for the safety thaw.
2909+- An exported array can't be read as a slice outside its module — a slice can be written through; "A slice that can't be written: `[]const T`" in PROPOSALS.md would answer it. Comes with `[]const T` in the safety thaw (`PLAN.md` §2).
29092910 - An exported variable can't be assigned from outside — Oberon's read-only export; a setter shows who writes.
29102911 - A generic instance isn't reachable through the module that imported it — no bug: an import's name is never exported (3); export a type of the instance, or import it again.
29112912 - `I32` doesn't widen to `INT` — `INT` may be 16 bits (5.1), so the widening would not hold everywhere.