Okay, I can get that stack trace, but there's no line for clojure.core/
divide in your trace.  How would I know which function threw the
exception?  "eval" isn't very useful.  Ideally I'd like a line number,
too.

If I have a function,

(defn process [sequence]
  (map some-function sequence))

And it gets called by another function,

(defn higher-up [sequence]
  (concat (list 1 2 3 4 5) (process sequence)))

And that gets called by

(higher-up 12) ;; note:  12 is not a seq

Then the stack trace for "don't know how to create ISeq from 12"
doesn't mention anything about 'higher-up or 'process at all.  It's
lazy-seq evals and fn invokes.  The error occurs in a closure that was
created inside these functions being evaluated to print a lazy seq,
but most of the work done by programs occurs in contexts like that.
If the closure can't have a context and line numbers attached, is it
just impossible to have meaningful debugging and stack traces?

On May 13, 12:05 pm, MarkSwanson <mark.swanson...@gmail.com> wrote:
> On May 13, 6:11 am, Brian Watkins <wildu...@gmail.com> wrote:
>
> > What is the method that gets line numbers and function names into
> > stack traces?  I know I can't get them in the Repl (because there
> > aren't any), but I tried loading my file with load-file and that
> > doesn't help either.
>
> It's there; Clojure binds the last Exception to *e
>
> http://tech.puredanger.com/2010/02/17/clojure-stack-trace-repl/
>
> user=> (use 'clojure.stacktrace)
> nil
> user=> (/ 5 0)
> java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)
> user=> (print-stack-trace *e)
> clojure.lang.Compiler$CompilerException:
> java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)
>  at clojure.lang.Compiler.eval (Compiler.java:5365)
>     clojure.lang.Compiler.eval (Compiler.java:5317)
>     clojure.core/eval (core.clj:2132)
> ...
>
> I use vimclojure and in its repl embedded inside vim all I have to do
> is ,st or ,ct
>
> --
> 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 
> athttp://groups.google.com/group/clojure?hl=en

-- 
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

Reply via email to