>Stuart Halloway said in his video Clojure in the Field (
>http://www.infoq.com/presentations/Clojure-tips) from March 1, 2013 (I 
>think): "I don't feel the absence of a debugger because I've learnt enough 
>that I don't ever need a debugger." I am very intrigued by that statement. 
>What does he (or you, if you are reading, Stuart) mean? For me, debugging 
>is the biggest thing that I don't know how to do well currently in Clojure 
>(I use Vim, and have not programmed in Clojure for a while), so I am really 
>interested in what he meant.

Like Stuart, I haven't used a debugger in years.  I find that debuggers
give me something to do with my hands while thinking about the
failure. They used to be very useful on slow machines but these
billion-instructions-per-second toys we have now just tend to overwhelm
with data.

Try "navel debugging". Write a few lines of code, rebuild the system,
test that it works the way you expect. If it fails the failure is almost
certainly in the changes you just made. Sit back, contemplate your
navel, stare at the code, and the nature of the bug will likely reveal
itself. Most likely the bug is in the piece of code you don't understand.

Of course, this won't work well when working with other people's code.
Finding those bugs usually requires human to human communication. 

The REPL is your best friend. You can "hand execute" small pieces of
code to test your assumptions. 

Common Lisp systems have wonderfully powerful trace functions allowing
arbitrary conditions and actions.

I haven't seen anything like that in Clojure yet. Is it possible to
dynamically swap a Clojure function definition with a trace function?
You would have to interpret the tracer's code fragments in the lexical
environment of the call.  Are environments first class objects in
Clojure? How would that work in an STM code block? How do you "stack
smash" an immutable data structure and continue execution from the
breakpoint? How would you mutate a value in the caller's environment?

Tim


-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to