Debugging in Clojure

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • debug-repl

    A Clojure debug repl as nrepl middleware

  • This isn’t mentioned in the article, but I found debug-repl [1] to be 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.”

    [1] https://github.com/gfredericks/debug-repl

  • spyscope

    Trace-oriented debugging tools for Clojure

  • The first example about spyscope is.. not good. The point of it is you can stick it in front of any form, not to use it with println debugging. For a better example, at https://github.com/dgrnbrg/spyscope#spyp

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • mulog

    μ/log is a micro-logging library that logs events and data, not words!

  • Assuming the crash doesn't cause the process to completely exit, you could indeed use `scope-capture` for this. This works well for local dev. In theory, you could use `sc.api/spy` in production code, and then attach a remote repl to diagnose any crashes. I wouldn't recommend this though, I think it would be best to use a good logging library like Mulog: https://github.com/BrunoBonacci/mulog

  • cider

    The Clojure Interactive Development Environment that Rocks for Emacs (by clojure-emacs)

  • I asked something similar on the Cider Github and it sounds like it's not possible to get ELisp level debugging:

    https://github.com/clojure-emacs/cider/discussions/2999

    If anything Clojure needs this more than ELisp b/c of the crazy error stacks and b/c of how the laziness makes things blow up in all sorts of weird places

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts