|I never end up using a debugger with dynamic languages. I have nothing against debuggers, and I'd use one if I found it useful to me, but when I'm in the middle of my code and wanting to find out what's going on I just stick in the plain old debug print statement:|
But, notice the redundancy, I type "i" twice. So I wrote a macro "erp" (short for "stderr print"), which prints to stderr its argument, both literally and what it evaluates to. And, it returns the result as well, so it can be inserted in the middle of some code.
(prn "i: " i)
For example, if I'm looking at
and thinking, "wait, what is (/ 4 2) evaluating to again?", I stick in erp:
(+ 3 (/ 4 2) 5)
I find that most often just seeing the literal expression that's being printed gives me enough context to tell me which one it is.
arc> (+ 3 (erp (/ 4 2)) 5)
(/ 4 2): 2
(mac erp (x)
`(let ,gx ,x
(pr ',x ": ") (write ,gx) (prn))