I'm concerned specifically about exceptions that occur during macro expansion. As often as not, these exceptions are the result of calling the macro with incorrect arguments rather than any problem in the macro itself, but the stack trace doesn't contain enough information to locate the offending macro call. For instance, the stack trace I posted reports macro-fail.clj line 0 as the ultimate source of the problem, even though the macro is called on line 3.
I've done some more tests using the 1.0 release as well as the latest head from git, and in both versions, the stack trace contains the name of the file where the macro is called, but the line number is always 0. Since the file name is correct, I think my comments about hacking the reader were off-base, but there is definitely a problem with reporting the correct line number. On Mon, Feb 8, 2010 at 2:08 PM, Michał Marczyk <michal.marc...@gmail.com>wrote: > On 8 February 2010 20:11, John R. Williams <shponglesp...@gmail.com> > wrote: > > ;; macro-fail.clj > > (defmacro broken [] (/ 0 0)) > > (broken) > > [ ... ] > > As you can see, line 3, where the macro is used, appears nowhere in > > the stack trace. > > That's because execution never reaches this point, because the (/ 0 0) > bit gets executed at macro expansion time. You'd have to syntax-quote > it to fail at runtime: > > (defmacro broken [] `(/ 0 0)) > > (A regular quote would probably also do.) > > Also, note the user$broken ... line in your stack trace -- it does > contain a useful indication of the source of the problem. > > Sincerely, > Michał > > -- > 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<clojure%2bunsubscr...@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 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