| | @@ -1,6 +1,6 @@ |
| 1 | 1 | # Proposal: report 2026-10.22 |
| 2 | 2 | |
| 3 | | -Two changes that take rules out of the language. Neither adds a feature. |
| 3 | +Three changes that take rules out of the language and the conformance suite. Neither adds a feature. |
| 4 | 4 | Nothing in `doc/raz.md` or the code changes until the owner approves |
| 5 | 5 | this; it is a thaw of the freeze (CLAUDE.md), so it needs the owner's |
| 6 | 6 | word. |
| | @@ -112,15 +112,64 @@ |
| 112 | 112 | "slice an array in it" and "`match` on a copy" can't arise. That |
| 113 | 113 | keeps `Scan.tok` and the compiler's speed, and removes the odd cases, |
| 114 | 114 | for about half the saving. |
| 115 | + |
| 116 | +## 3. Conformance covers valid programs only; warnings leave the report |
| 115 | 117 | |
| 118 | +**Now.** `conform/err/` holds 235 programs the report calls errors, and |
| 119 | +an implementation passes only if each one fails to compile |
| 120 | +(`conform/check.sh`; appendix A: "A program that is an error in this |
| 121 | +report is one in every implementation"). Section 10 also tells the |
| 122 | +compiler what to warn of (unused names, a dropped result) and defines |
| 123 | +`-Werror`. |
| 124 | + |
| 125 | +**Proposed.** |
| 126 | + |
| 127 | +- `conform/` holds `run/` only. An implementation conforms if it |
| 128 | + compiles every valid program there and each runs as the report |
| 129 | + says, with the output and status expected. `conform/err/` and the |
| 130 | + loop that runs it in `check.sh` go; the programs move to `test/err/` |
| 131 | + with their `.err` files, where this compiler's own tests live, and |
| 132 | + `test/msg`'s twins merge with them. |
| 133 | +- The report still says what is not valid raz ("is an error"). What an |
| 134 | + implementation does with an invalid program is its own: it should |
| 135 | + say so and stop, as this compiler does, but one that compiles it, |
| 136 | + or compiles it to something else, still conforms. Appendix A's |
| 137 | + "Messages and warnings" line becomes "What it does with a program |
| 138 | + that isn't valid, the text of its messages, and which warnings it |
| 139 | + gives". |
| 140 | +- Section 10's "Messages" paragraph, on the form of an error, the 20 |
| 141 | + errors, skipping to the next statement and "did you mean", and the |
| 142 | + paragraph on warnings, are moved to `doc/compiler.md` under "This |
| 143 | + compiler's choices". `-Werror` is an option of this compiler's, not |
| 144 | + of the language (it is already a command-line matter, appendix A). |
| 145 | +- Failed checks at run time (an index out of range, a nil pointer, a |
| 146 | + division by zero) stay in the report and in `conform/run`: they are |
| 147 | + how a valid program behaves, with status 2 and a message on |
| 148 | + standard error whose text is the implementation's. |
| 149 | + |
| 150 | +**What it costs.** An implementation can no longer be shown to reject |
| 151 | +what the report forbids, so a program valid on one compiler may not |
| 152 | +be on another; this compiler keeps its diagnostics and its tests, and |
| 153 | +that is where portability is held. Nothing changes for a program that |
| 154 | +compiles today. |
| 155 | + |
| 156 | +**What it saves.** For another implementation, the whole checker's |
| 157 | +rejecting half: it needs to resolve names and types of valid programs, |
| 158 | +not to find the fault in an invalid one. In the Ref compiler that |
| 159 | +half (every `error_at`, `suggest`, the warning pass, unused-name |
| 160 | +tracking and `coerce`'s rejections) is a large share of the 3,000 |
| 161 | +lines of `expr.c` and `check.c`; I'd put it at a third, but have not |
| 162 | +counted. For this compiler nothing is removed by the change itself. |
| 163 | + |
| 116 | 164 | ## Order, if approved |
| 117 | 165 | |
| 118 | 166 | 1. Report: `doc/raz.md` (the sections above and an entry in 12), the |
| 119 | 167 | grammar in appendix B, `doc/compiler.md` where it names the rules. |
| 120 | 168 | 2. `conform/` and `test/`: the tests named above. |
| 121 | | -3. The compiler: `src/`, one commit per step as CLAUDE.md says; then |
| 169 | +3. `conform/check.sh` and the move of `conform/err` to `test/err`. |
| 170 | +4. The compiler: `src/`, one commit per step as CLAUDE.md says; then |
| 122 | 171 | `make check`, `make fixpoint`, `make bench`. |
| 123 | | -4. Library and `src/` rewrites for change 2. |
| 172 | +5. Library and `src/` rewrites for change 2. |
| 124 | 173 | |
| 125 | | -Change 1 can go alone; change 2 should wait for a measurement of what |
| 174 | +Changes 1 and 3 can go alone; change 2 should wait for a measurement of what |
| 126 | 175 | the accessors cost the compiler. |