beginners 2026-02-21

Put together a small debug macro for my current project. It does the job, but are there any standard libraries or better patterns I should be looking at instead? https://github.com/amiorin/big-config/blob/1a334791c395aefc1fa040c744c2ee614cbdc749/src/clj/big_config/utils.clj#L65

I'd say yes. At a quick glance, your macro doesn't support nesting, for example. Personally, I much prefer to use "raw" taps with something like Portal. Getting tapped values back to the REPL is trivial. Tap hierarchy and scope are easy to maintain - well, at least in non-concurrent contexts. Just add some specific structure to the tapped values. In concurrent contexts, not much harder - just add the thread name to the tapped structure.

@alberto.miorin shameless plug here but https://www.flow-storm.org/ is a project that takes that idea much further.

➕ 2

@alberto.miorin not sure if it is a fit for your current project, but https://github.com/paintparty/fireworks offers the featureful debugging macro, ? , which is focused on themeable printing in the context of a hot-reloaded workflow. There is also a ?> macro for raw tapping that you could use in conjunction with something like Portal. Some basic https://github.com/paintparty/fireworks?tab=readme-ov-file#editor-integrations were recently added. There is also a section of the readme with https://github.com/paintparty/fireworks?tab=readme-ov-file#alternatives--prior-art that may be of interest.

requiring-resolve returns a stale version of the function. The fn is ok, the symbol is stale, why? I have restarted the JVM and executed cider-load-buffer. Is there a dot directory that I should delete? What is the correct procedure to avoid this problem?

(defn- resolve-fn [kw opts]
  (let [f (get opts kw)]
    (cond
      (nil? f) (throw (ex-info (format "`%s` not defined" kw) opts))
      (fn? f) f
      (symbol? f) (requiring-resolve f)
      :else (throw (ex-info (format "Value for `%s` is neither a function nor a symbol" kw) opts))))) 

What exactly do you do to reproduce it? How do you determine that it's stale?

➕ 2

I've seen this with aot classes being left around. Those are consulted before source files iirc

➕ 1

FWIW the logic is

lastModified(classURL, classfile) > lastModified(cljURL, scriptfile)
i.e. classfiles are prefered to clj sources IFF clj sources have not been modified since the classfiles have been compiled

👍 2