Re: trace-forms macro

2011-09-27 Thread Luc Prefontaine
Fine, I merged the new version and I will add a couple of tests related to 
these changes.

Luc

On Mon, 26 Sep 2011 18:46:12 +0200
Jonathan Fischer Friberg odysso...@gmail.com wrote:

 I looked at it today and have updated the macro.
 (same gist: https://gist.github.com/1209498)
 
 Additions:
 It detects if a form contains (recur ...), and if it does,
 the form isn't wrapped in (try ...).
 
 trace vectors, maps, and sets.
 
 trace (fn* ...)  (new ...)
 
 ---
 
 The code feels a bit thrown together right now, if anyone would
 like to take a look,
 that would be great.
 
 ---
 
 To Marczyk:
 Sure, where to?
 
 Jonathan
 
 On Sat, Sep 24, 2011 at 10:27 PM, Michał Marczyk
 michal.marc...@gmail.comwrote:
 
  Oh, that's a nice idea! Definitely looks like a worthy addition to
  the trace lib.
 
  I believe the process around contributions to contrib involves a CA,
  though; Jonathan: do you have one in place? Any chance you might be
  convinced to submit one if not? :-)
 
  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
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
 
 



-- 
Luc P.


The rabid Muppet

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


tools.trace (was Re: trace-forms macro on the clojure mailing list)

2011-09-27 Thread Luc Prefontaine
Hi,

First shot of tools.trace is now available on github:

http://github.com/clojure/tools.trace

As for the traceforms macro, you will notice that when an exception is trapped, 
I recompose
an new exception with the necessary form traceback information instead of using 
print.
The main reason is that I want the form traceback to stay close to the 
exception message.
Otherwise if you run several threads writing to stdout, you may end up with 
split
outputs on standard output (the exception message in one spot and the form 
traceback elsewhere)

Comments/suggestions are welcomed.

The README.MD is on its way and I still need to review the code to see if they 
are
remaining rough edges. Nothing beats a paper output and a coffee...

I expect to work on the build process next week-end and get the first version 
out next week.

Time to go to bed, my eyes are now useless ...

Luc P.

On Mon, 26 Sep 2011 18:46:12 +0200
Jonathan Fischer Friberg odysso...@gmail.com wrote:

 I looked at it today and have updated the macro.
 (same gist: https://gist.github.com/1209498)
 
 Additions:
 It detects if a form contains (recur ...), and if it does,
 the form isn't wrapped in (try ...).
 
 trace vectors, maps, and sets.
 
 trace (fn* ...)  (new ...)
 
 ---
 
 The code feels a bit thrown together right now, if anyone would
 like to take a look,
 that would be great.
 
 ---
 
 To Marczyk:
 Sure, where to?
 
 Jonathan
 
 On Sat, Sep 24, 2011 at 10:27 PM, Michał Marczyk
 michal.marc...@gmail.comwrote:
 
  Oh, that's a nice idea! Definitely looks like a worthy addition to
  the trace lib.
 
  I believe the process around contributions to contrib involves a CA,
  though; Jonathan: do you have one in place? Any chance you might be
  convinced to submit one if not? :-)
 
  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
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
 
 



-- 
Luc P.


The rabid Muppet

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


Re: tools.trace (was Re: trace-forms macro on the clojure mailing list)

2011-09-27 Thread Sean Corfield
Thank you Luc!

On Tue, Sep 27, 2011 at 11:44 PM, Luc Prefontaine
lprefonta...@softaddicts.ca wrote:
 First shot of tools.trace is now available on github:

 http://github.com/clojure/tools.trace

 As for the traceforms macro, you will notice that when an exception is 
 trapped, I recompose
 an new exception with the necessary form traceback information instead of 
 using print.
 The main reason is that I want the form traceback to stay close to the 
 exception message.
 Otherwise if you run several threads writing to stdout, you may end up with 
 split
 outputs on standard output (the exception message in one spot and the form 
 traceback elsewhere)

 Comments/suggestions are welcomed.

 The README.MD is on its way and I still need to review the code to see if 
 they are
 remaining rough edges. Nothing beats a paper output and a coffee...

 I expect to work on the build process next week-end and get the first version 
 out next week.

 Time to go to bed, my eyes are now useless ...

 Luc P.

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


Re: trace-forms macro

2011-09-26 Thread Jonathan Fischer Friberg
I looked at it today and have updated the macro.
(same gist: https://gist.github.com/1209498)

Additions:
It detects if a form contains (recur ...), and if it does,
the form isn't wrapped in (try ...).

trace vectors, maps, and sets.

trace (fn* ...)  (new ...)

---

The code feels a bit thrown together right now, if anyone would like to
take a look,
that would be great.

---

To Marczyk:
Sure, where to?

Jonathan

On Sat, Sep 24, 2011 at 10:27 PM, Michał Marczyk
michal.marc...@gmail.comwrote:

 Oh, that's a nice idea! Definitely looks like a worthy addition to the
 trace lib.

 I believe the process around contributions to contrib involves a CA,
 though; Jonathan: do you have one in place? Any chance you might be
 convinced to submit one if not? :-)

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

Re: trace-forms macro

2011-09-24 Thread Jonathan Fischer Friberg

 I am moving the trace contrib stuff to 1.3. I would like to include your
 trace-forms
 macro in it. Feeling ok with this ? Comments ?


Sounds good to me.
After all, I sent it to this list so that others could make use of it!

When it comes to issues, in 1.3 it's not allowed to recur across (try ...),
which means that the macro wont work with (loop (recur ...)) or (fn ...
(recur ...)).

Also, the big missing thing is that (trace-special-form) doesn't cover fn*,
i.e. the body of functions wont be traced.

Jonathan

On Sat, Sep 24, 2011 at 7:03 AM, Luc Prefontaine 
lprefonta...@softaddicts.ca wrote:

 Hi Jonathan,

 I am moving the trace contrib stuff to 1.3. I would like to include your
 trace-forms
 macro in it. Feeling ok with this ? Comments ?

 The issues you underlined are not runtime errors, they are compilation
 errors.
 There's not much you can do to trap these.
 The macro is still valuable for runtime tracing.

 Luc P.

 On Mon, 12 Sep 2011 11:31:39 +0200
 Jonathan Fischer Friberg odysso...@gmail.com wrote:

  Hello,
 
  I made a small macro, if anyone is interested.
  https://gist.github.com/1209498
 
  It wraps one or more forms and if an exception is thrown,
  prints the form that caused it, and throws the exception itself.
 
  Examples:
 
  user= (trace-forms 3)
  3
 
  user= (trace-forms (+ 6 (/ 9 0)))
  java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:9)
  Form failed: (/ 9 0)
  Form failed: (+ 6 (/ 9 0))
 
  user= (trace-forms (let [a 0 b (/ 9 a)] b))
  java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:75)
  Form failed: (/ 9 a)
  Form failed: (let* [a 0 b (/ 9 a)] b)
  Form failed: (let [a 0 b (/ 9 a)] b)
 
  Issues:
 
  user= (trace-forms (let [b (/ 9 a)] b))
  java.lang.Exception: Unable to resolve symbol: a in this context
  (NO_SOURCE_FILE:94)
 
  user= (trace-forms (let [a (java.lang.DoesNotExist.)] a))
  java.lang.ClassNotFoundException: java.lang.DoesNotExist
  (NO_SOURCE_FILE:93)
 
  
 
  Thoughts?
 
  Jonathan
 



 --
 Luc P.

 
 The rabid Muppet

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

Re: trace-forms macro

2011-09-24 Thread Luc Prefontaine
Fine, I will have a closer look at the issues you mentioned.
I'll repost here when the code is available so you can have a look at it.

Luc

On Sat, 24 Sep 2011 21:33:47 +0200
Jonathan Fischer Friberg odysso...@gmail.com wrote:

 
  I am moving the trace contrib stuff to 1.3. I would like to include
  your trace-forms
  macro in it. Feeling ok with this ? Comments ?
 
 
 Sounds good to me.
 After all, I sent it to this list so that others could make use of it!
 
 When it comes to issues, in 1.3 it's not allowed to recur across
 (try ...), which means that the macro wont work with (loop
 (recur ...)) or (fn ... (recur ...)).
 
 Also, the big missing thing is that (trace-special-form) doesn't
 cover fn*, i.e. the body of functions wont be traced.
 
 Jonathan
 
 On Sat, Sep 24, 2011 at 7:03 AM, Luc Prefontaine 
 lprefonta...@softaddicts.ca wrote:
 
  Hi Jonathan,
 
  I am moving the trace contrib stuff to 1.3. I would like to include
  your trace-forms
  macro in it. Feeling ok with this ? Comments ?
 
  The issues you underlined are not runtime errors, they are
  compilation errors.
  There's not much you can do to trap these.
  The macro is still valuable for runtime tracing.
 
  Luc P.
 
  On Mon, 12 Sep 2011 11:31:39 +0200
  Jonathan Fischer Friberg odysso...@gmail.com wrote:
 
   Hello,
  
   I made a small macro, if anyone is interested.
   https://gist.github.com/1209498
  
   It wraps one or more forms and if an exception is thrown,
   prints the form that caused it, and throws the exception itself.
  
   Examples:
  
   user= (trace-forms 3)
   3
  
   user= (trace-forms (+ 6 (/ 9 0)))
   java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:9)
   Form failed: (/ 9 0)
   Form failed: (+ 6 (/ 9 0))
  
   user= (trace-forms (let [a 0 b (/ 9 a)] b))
   java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:75)
   Form failed: (/ 9 a)
   Form failed: (let* [a 0 b (/ 9 a)] b)
   Form failed: (let [a 0 b (/ 9 a)] b)
  
   Issues:
  
   user= (trace-forms (let [b (/ 9 a)] b))
   java.lang.Exception: Unable to resolve symbol: a in this context
   (NO_SOURCE_FILE:94)
  
   user= (trace-forms (let [a (java.lang.DoesNotExist.)] a))
   java.lang.ClassNotFoundException: java.lang.DoesNotExist
   (NO_SOURCE_FILE:93)
  
   
  
   Thoughts?
  
   Jonathan
  
 
 
 
  --
  Luc P.
 
  
  The rabid Muppet
 
  --
  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
 
 



-- 
Luc P.


The rabid Muppet

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


Re: trace-forms macro

2011-09-24 Thread Michał Marczyk
Oh, that's a nice idea! Definitely looks like a worthy addition to the
trace lib.

I believe the process around contributions to contrib involves a CA,
though; Jonathan: do you have one in place? Any chance you might be
convinced to submit one if not? :-)

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
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: trace-forms macro

2011-09-23 Thread Luc Prefontaine
Hi Jonathan,

I am moving the trace contrib stuff to 1.3. I would like to include your 
trace-forms
macro in it. Feeling ok with this ? Comments ? 

The issues you underlined are not runtime errors, they are compilation errors.
There's not much you can do to trap these.
The macro is still valuable for runtime tracing.

Luc P.

On Mon, 12 Sep 2011 11:31:39 +0200
Jonathan Fischer Friberg odysso...@gmail.com wrote:

 Hello,
 
 I made a small macro, if anyone is interested.
 https://gist.github.com/1209498
 
 It wraps one or more forms and if an exception is thrown,
 prints the form that caused it, and throws the exception itself.
 
 Examples:
 
 user= (trace-forms 3)
 3
 
 user= (trace-forms (+ 6 (/ 9 0)))
 java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:9)
 Form failed: (/ 9 0)
 Form failed: (+ 6 (/ 9 0))
 
 user= (trace-forms (let [a 0 b (/ 9 a)] b))
 java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:75)
 Form failed: (/ 9 a)
 Form failed: (let* [a 0 b (/ 9 a)] b)
 Form failed: (let [a 0 b (/ 9 a)] b)
 
 Issues:
 
 user= (trace-forms (let [b (/ 9 a)] b))
 java.lang.Exception: Unable to resolve symbol: a in this context
 (NO_SOURCE_FILE:94)
 
 user= (trace-forms (let [a (java.lang.DoesNotExist.)] a))
 java.lang.ClassNotFoundException: java.lang.DoesNotExist
 (NO_SOURCE_FILE:93)
 
 
 
 Thoughts?
 
 Jonathan
 



-- 
Luc P.


The rabid Muppet

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


Re: trace-forms macro

2011-09-14 Thread Sergey Didenko
Looks interesting. Did you use it with Clojure 1.3 or earlier?

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


Re: trace-forms macro

2011-09-14 Thread Jonathan Fischer Friberg
It was tested with 1.2.1

Jonathan

On Wed, Sep 14, 2011 at 9:09 AM, Sergey Didenko sergey.dide...@gmail.comwrote:

 Looks interesting. Did you use it with Clojure 1.3 or earlier?

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

trace-forms macro

2011-09-12 Thread Jonathan Fischer Friberg
Hello,

I made a small macro, if anyone is interested.
https://gist.github.com/1209498

It wraps one or more forms and if an exception is thrown,
prints the form that caused it, and throws the exception itself.

Examples:

user= (trace-forms 3)
3

user= (trace-forms (+ 6 (/ 9 0)))
java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:9)
Form failed: (/ 9 0)
Form failed: (+ 6 (/ 9 0))

user= (trace-forms (let [a 0 b (/ 9 a)] b))
java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:75)
Form failed: (/ 9 a)
Form failed: (let* [a 0 b (/ 9 a)] b)
Form failed: (let [a 0 b (/ 9 a)] b)

Issues:

user= (trace-forms (let [b (/ 9 a)] b))
java.lang.Exception: Unable to resolve symbol: a in this context
(NO_SOURCE_FILE:94)

user= (trace-forms (let [a (java.lang.DoesNotExist.)] a))
java.lang.ClassNotFoundException: java.lang.DoesNotExist (NO_SOURCE_FILE:93)



Thoughts?

Jonathan

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