Hacker News new | ask | show | jobs
by zurn 1804 days ago
For those of us using CIDER don't forget #break / #dbg!

https://docs.cider.mx/cider/debugging/debugger.html#using-th...

1 comments

That allows you to step through code. but it doesn't break when you get a crash (like gdb). At least when I just tested:

     #dbg(defn get-first [input] (nth input 0))
     (get-first [4 2 3]) ;; 4
     (get-first 5) ;; gives me a stack trace and no program state
So it's nice to have, but I think this is maybe only useful if you're working through someone else's code?
This is not such a huge issue in practice. It is often enough to step through the debugger and see exactly what is failing.

In conjunction with scope-capture, it is trivial to run that failing code again to have a closer look, and modify it to your liking till it runs as expected.

There are also conditional restart systems for Clojure that offer much more than this.