r/Clojure•
Muoniurn

Breakloop development in Clojure

I’ve read the recent hn thread titled “Why Lisp” https://news.ycombinator.com/item?id=29202021 and found a few references to “breakloop” debugging/development with CL which is according to the commenter is not (yet?) possible with Clojure. From what I gather they refer to something like running a half-ready application and in case of an exception, the REPL will jump to the cause with all the state loaded and one can modify that and re-run from that exact point.

Posted Nov 15, 2021, 8:50 AM UTC

122
la-rokci•

Common Lisp uses conditions, which don't discard the stack. So when a condition is signaled you are left in the debugger, can inspect all values, including locals, change them and restart at the point where the condition was signaled. This kind of development is not inherent to clojure. The pragmatic choice was to use what the platform uses. Clojure could be built around conditions, there are libraries implementing the concept. But if clojure used them everywhere it would make java interop harder. Same on the JS side.

8
arichiardi•

As far as I know you can't yet break on exceptions in cider but you can definitely break at any form (there are very few exceptions), inspect locals and eval expressions. It is probably different from the Common Lisp flow but I found it quite useful!

2