WIP: nREPL middleware for beginner-friendly error messages.


Details
We will introduce a new, work-in-progress nREPL middleware for transforming Clojure error messages into a form understandable to beginner programmers. For instance, a Clojure message for an erroneous call (+ 6 "7") is: ClassCastException java.lang.String cannot be cast to java.lang.Number. In our software it would be replaced by: Attempted to use a string, but a number was expected. We approach the task from multiple angles:
-
We have a system that applies regular expressions to replace the wording of the standard Clojure messages. This includes replacing type names to those that are easier to understand, rephrasing the language of the error message itself, and in some cases even suggesting a likely reason for an error.
-
We also process spec errors that are already included in clojure.core for macros.
-
We add our own error specs for common functions and macros and then rewrite them for beginners.
Our project also includes a utility tool for deriving likely specs for a namespace based on names of parameters in docstrings and a testing utility that records the original and the modified error messages, for easier viewing.
This is a continuation of an ongoing work at UMM on improving Clojure error messages, and it builds upon work done by students in previous years, some of which was presented at the MN meetup. This round of the project, while still work in progress, is on track to become nREPL middleware that will be available to download and use with any repl or IDE.
The project (very much work in progress) is available here: https://github.com/Clojure-Intro-Course/babel
Presenters:
UMM students:
Dexter An (test logging),
RJ Holman (processing Clojure core specs for macros),
Ethan Uphoff (developing our own specs; rewriting non-spec error messages; automated spec generation)
Charlot Shaw (connecting error messages processing as nREPL middleware) can’t be at the presentation, but has contributed essential components of the project.
UMM CS faculty: Elena Machkasova

WIP: nREPL middleware for beginner-friendly error messages.