diff --git a/NEXT.md b/NEXT.md index 091f38c..41f1e41 100644 --- a/NEXT.md +++ b/NEXT.md @@ -478,7 +478,39 @@ run one lane at a time; item 4 is disjoint and runs alongside any of them. because `check_dotimes` folds the step into the body and a `continue` branching to the header would skip it and hang. -8. **More than one error per compile.** Raised by the author's workflow: write everything, compile at the end, squash +8. **Errors: a structured value with spans and notes, and more than one per compile.** One piece of work, not two — + both need `Loc.Error` to stop being a single location plus a string. + + **Today:** `lib/loc.ml` carries a point location and a message, and `Loc.Error` is the frontend's *one* exception, so + the first error aborts the run. The author's workflow is write everything, compile at the end, squash the list — + which cannot work when there is never a list. The *content* of the messages is already good; they state the reason + and name what to write instead. What is missing is structure and volume. + + **jank is the model** (`~/Repositories/jank`, `compiler+runtime/include/cpp/jank/error.hpp`). It is a Lisp on LLVM + with unusually good diagnostics and three things worth taking: + + - **A named `kind` per error** — roughly a hundred, `lex_unterminated_string`, `parse_odd_entries_in_map` — each with + a stable string id. Machine-readable classification with no JSON mode and no prose parsing. + - **A source *span*, not a point.** This is what draws Elm's squiggle: you underline a range. A column number cannot. + - **Notes: an error carries zero or more, each with its own span and its own severity** (info/warning/error), sorted + by position. **This is the actual secret of Elm-quality messages** — "this is wrong *here*" plus "because of *that* + over there", two places highlighted and each explained. One location and one string can never express it. + + jank also carries the **macro expansion** an error came from, which this project will want once macros land, and it + is worth building the field now rather than retrofitting it. + + **Then collect rather than raise:** finish the function, finish the file, report everything found. Error recovery in + a checker is real work — the hard part is resynchronising after a bad form without cascading nonsense — and it is + what the workflow actually needs. + + **No editor work is required.** Flan already prints `file:line:col: message`, the GNU format Emacs's + `compilation-mode` parses with no configuration, so `M-x compile` gives a clickable list and `next-error` free. + Flycheck and a structured JSON report were both considered and are **not** wanted — the workflow is + compile-at-the-end, not live linting. + + **Cannot run beside the current lanes**: it touches every file that raises, which is the whole frontend. + +8b. **The old entry, kept for its one extra fact:** Raised by the author's workflow: write everything, compile at the end, squash the list. That does not work today — `Loc.Error` is the frontend's **one** exception, so the first error aborts the run and you get them one at a time, which is exactly the loop that workflow exists to avoid.