On 5/28/13 10:37 AM, Cedric Greevey wrote:
Huh. I just solved it. The debug exception handler has to do something
a bit fancier, that's all:
1. Dig up the bytecode of the method executing the throw and copy it
somewhere.
2. Unwind by one call.
3. Take the bytecode in 1, alter it to wrap the throw site in
redl.core/break's macro expansion that captures locals, or something
similar, and replacing the offending throw with a direct punt to the
debug REPL.
4. Load a class with that as its only method.
5. Invoke that method, with the same arguments as the ...
Ah, crap. The arguments might have been locals-cleared by then, in the
caller, and by the time of the throw in the callee. Damn damn damn. It
would have to recurse farther up the stack and who knows where it
would stop? So even with pure functions this enhanced scheme still
would only sometimes work -- and with side-effecting ones you have
side effects happening twice.
I think locals clearing is simply incompatible with ever having full
debug info at an error site without anticipation of an error at that
site, and with anticipation you can put debug prints, logging,
watchers, and suchlike at the site.
You can disable locals clearing with a compiler flag. nrepl-ritz even
has helper function that will compile the given form using that flag.
If you want to disable locals clearing on a project wide basis you can
do so with lein's JVM opts.
--
--
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.