The first example about spyscope potentially confuses the reader a bit by using it in context of println debugging. The point of it is you can stick it in front of any form. For a better example, see <a href="https://github.com/dgrnbrg/spyscope#spyp" rel="nofollow">https://github.com/dgrnbrg/spyscope#spyp</a><p>Otherwise great article, I hadn't heard about scope-capture.
For those of us using CIDER don't forget #break / #dbg!<p><a href="https://docs.cider.mx/cider/debugging/debugger.html#using-the-debugger" rel="nofollow">https://docs.cider.mx/cider/debugging/debugger.html#using-th...</a>
This isn’t mentioned in the article, but I found debug-repl [1] to be amazing when debugging in the repl. For simple prints, wrapping expressions in (doto prn) has always been enough for me without custom readers. But when debugging something super odd, just stopping somewhere and evaluating a bunch of code (with locals in scope) to understand what you’re dealing with is invaluable. Clojure’s immutability makes it especially nice since you can just rerun (most) expressions to “see what happens.”<p>[1] <a href="https://github.com/gfredericks/debug-repl" rel="nofollow">https://github.com/gfredericks/debug-repl</a>
Some additional conversation on this blog post here:<p><a href="https://www.reddit.com/r/Clojure/comments/oe40af/debugging_in_clojure_dave_martins_blog/?sort=confidence" rel="nofollow">https://www.reddit.com/r/Clojure/comments/oe40af/debugging_i...</a>
For people who want to get a more CL-like debugging setup on Clojure, there is a CL-style condition system available as a library.<p><a href="https://github.com/IGJoshua/farolero/" rel="nofollow">https://github.com/IGJoshua/farolero/</a>
Could `scope-capture` be used to capture state before a crash?<p>What would be nice is a GDB-like state along with stacktraces when you get a crash. Clojure stack traces are notoriously long and spooky. You learn to read the tea leaves, but even if you manage to identify where the crash happened and what triggered it (not always obvious..) you then need to pepper things with `println` to figure out the last local state before the whole thing blew up.<p>It looks like once you've found the problem area you can use `sc.api/spy` ..? It'd at least solve half the problem
Does the Clojure debugger give a live Repl, where one can examine values of locals and restart execution if required, likes the elisp debugger in Emacs?