HACKER Q&A
📣 schemescape

Languages/environments with Common Lisp-like breakloops/interactivity?


As far as I understand, Common Lisp's condition system and various dynamic features enable "breakloops" where you can interactively handle an error, including modifying code and re-running it without any restarts (see [1] for a better description of the workflow). This sounds fun and I'd like to try it, but first I'm trying to determine if Common Lisp is the only (or best) option for testing this out.

Are there any other programming languages or development environments that support this?

Here's what I've found so far:

* Visual Studio's "edit and continue" feature for C/C++ might be similar

* GNU Scheme might support runtime modifications without restarts (note: it seemed like most other Schemes didn't support this--not sure why)

* Clojure's REPL might support this

* Smalltalk (edit: forgot this one when I originally posted)

I'm mostly just interested in seeing if this sort of functionality makes programming (subjectively) more productive/pleasant, and I think the best way is to just try it out. As an anecdote, I used to shy away from intelligent auto-complete, but now I consider it a requirement for hobby projects because it makes programming more enjoyable (no more constantly searching the docs to see what verb corresponds to "read", etc.).

Edit to add: I'm looking for more than just an "eval" function. I want to be able to redefine functions while I'm handling an error, ideally even with editor support (a la Emacs SLIME and Common Lisp).

[1] https://mikelevins.github.io/posts/2020-12-18-repl-driven/


  👤 lispm Accepted Answer ✓
Break loops were a relatively common ;-) feature in Lisp. Many Lisps had an interpreter in the REPL (with the option to compile code on demand) and in case of an error, a new 'break REPL' comes up with added debugging features and ways to leave it. This also allows more levels: an error in a break loop calls another break loop.

The addition of Common Lisp's Condition System (and Symbolics's 'New Error System') was to provide a machinery to handle errors and to provide interactive restarts to the user. Thus one has 1) a bunch of possible error conditions, 2) specific error handlers for signalled error conditions and 3) a bunch of restarts which can be called by the user. This typically also uses the feature that the error handling system doesn't about a routine in case of an error, but can call the error handling in the context of the error (-> the stack is not unwound). Thus all this machinery is now part of the programming language itself and not of a particular implementation.

There are not many software systems providing it in this way. For example the McCLIM Lisp Listener does. As does the SLIME IDE for Common Lisp / GNU Emacs. The most advanced was the error handling on the Symbolics Genera OS, where it provides hundreds of error conditions, many handlers and user interfaces for it. The commercial Lisps also have some UI support for it.

My personal opinion: a really good Lisp IDE / Environment should also make an extensive use of the condition system.


👤 account-5
I hope I'm not speaking out if turn but is darts hot reload similar to this? I've found it really good for hobby projects.


👤 jdougan
I believe Gilad Bracha's Newspeak does this.

👤 bjourne
Try Factor.