A lot of modules I'm working on have (set! *warn-on-reflection* true), However, I can only view the warnings when I load or eval the whole buffer/file. I typically eval the last top level defun and this doesn't show any warnings. Since the buffer level eval is not automated, sometimes I'll miss the reflection warnings and commit and push up my code. Any recommendations on how to automate this so that I stop missing reflection warnings? Things that come to mind are save and magit commit hooks in emacs. eastwood also catches these warnings, and that might be a good option for a CI, but for now, how do y'all approach this?
I have (alter-var-root #'*warn-on-reflection* (constantly true)) in my user.clj.
But it will turn it on globally for the entire project
Ah that might be a good way without needing to do something on the emacs side
This would work as well https://clojurians.slack.com/archives/C06MAR553/p1756827753587169
Hadn't heard of. @alexyakushev would know better about this feature
@joseph286 It shouldn't break nrepl, that's for sure. Does this shell command work for you once you add the .nrepl.edn file?
clojure -Sdeps "{:deps {nrepl/nrepl {:mvn/version \"1.5.2\"}}}" -m nrepl.cmdline -iI tried your solution, vemv, and it works just fine with a global version, however, I tried a local one because I want to check this into source control, however, when I added .nrepl.edn, it seems to have broken my nrepl or something because I can't connect Cider to it. Any idea what's going on?
Is it bad-form to frequently cider-ns-reload-all (or :reload-all in general, during development)?
It seems to be causing my #malli library to misbehave (seems like some sort of registry business might be getting missed/not-properly reloaded, it's hard for me to tell if it's explicitly a bug on malli's side yet (though I did file https://github.com/metosin/malli/issues/1253))
edit: (hmm, I see now that it might be, I still don't fully understand how these syncing problems might happen- I'd think :reload-all would set my REPL state back to 0, more or less)
> I'd think :reload-all would set my REPL state back to 0, more or less
:reload-all is tricky and depending on your system and the changes you made. It could leave it in an inconsistent state. That is why libraries like tools.namespace and clj-reload where created and also tools like components/integrant/mount etc exist.
Here are some link of tricky situations from :
• https://github.com/clojure/tools.namespace?tab=readme-ov-file#reloading-code-motivation
• https://github.com/tonsky/clj-reload?tab=readme-ov-file#comparison-evaluating-buffer
• and the https://www.cognitect.com/blog/2013/06/04/clojure-workflow-reloaded which goes over why libs like tools.namespace aren't enough
https://www.youtube.com/watch?v=NtyGShlZH1Q from the last Conj that goes over the history and inspiration for components and the reloaded workflow