Common mistake. For non-lispers: Macros evaluate from the outside, which means the defroutes macro will expand before the (comment ...) macro. For this to reliably work, you need a reader macro that removes the code before macro expansion. I don't know if clojure has that, but common lisp and some schemes have utilities for it.
The comment macro should really come with a warning that it should only be used as a top level form. Using it inline (a very natural thing to do if you're coming from a language with more typical block comments!) only ever leads to suffering, in my experience.
In that case you should use a reader ignore:
#_(GET "/something3" [] "hello3")
The reader ignore macro can be stacked in clojure, so you can also do
#_#_#_#_GET "/something3" [] "hello3"
if it strikes your fancy. The possibilities for bikeshedding here are truly remarkable.
Re:Rich Comment Blocks in Clojure
by clojurenoob on Friday October 09, 2020 @03:16PM
(#24733382)
I notice I accidently do similiar thing with parenedit. I can accidently move forms in and out of where they should be. Not an issue if the functions are small but with longer ones I might slurp off screen.
Re:Rich Comment Blocks in Clojure
by hombre_fatal on Friday October 09, 2020 @09:27PM
(#24736028)
I notice default syntax highlighting in Emacs, Vim, and VSCode make that odd-one-out "GET" a different color than the rest which would make this a lot easier to catch than otherwise.
Then when a client tried to access /something5 , I began getting null pointer execptions. This took me a while to figure out what I had done wrong.