Hi,

dotrace is used to trace fns by rebinding their vars and providing a list of
expressions to be traces in a restricted scope.

Like this:

(dotrace [my-add] (my-add 4 6) (my-add 7 3))

I played with it but now it's pretty useless because how vars are handled in 
1.4.
Not even sure if it works in 1.3.

If you do not need such restricted trace scope, why not use (trace (my-add 10 
2)) ?
Or deftrace instead of defn ?

If you need to dynamically enable/disable tracing of fns, use trace-vars/ 
trace-vars.
You will find a usage example in the readme.

In the next release I will change dotrace so it will work again.

Luc P.


> I'm trying to use dotrace from clojure.tools and having some trouble.
> 
> Here's my leiningen project file 
> 
> (defproject test1 "1.0.0-SNAPSHOT"
>   :description "test1"
>   :dependencies [[org.clojure/clojure "1.4.0"]
>                ]]
>   :dev-dependencies [
>      [swank-clojure "1.3.3"]
>                      [org.clojure/tools.trace "0.7.3"]
>                      ])
> 
> When trying to use dotrace I get the exception below:
> 
> user> (defn my-add [a b] (+ a b))
> user> (my-add 10 2)
> 12
> user> (clojure-version)
> "1.4.0"
> user> (my-add 10 2)
> 12
> user> (use 'clojure.tools.trace)
> user> (dotrace (my-add 10 2))
> ; Evaluation aborted.
> 
> THROWS 
> 
>   [Thrown class java.lang.ClassCastException]
> 
> Restarts:
>  0: [QUIT] Quit to the SLIME top level
> 
> Backtrace:
>   0: clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:635)
>   1: clojure.lang.Compiler.analyzeSeq(Compiler.java:6455)
>   2: clojure.lang.Compiler.analyze(Compiler.java:6262)
>   3: clojure.lang.Compiler.analyze(Compiler.java:6223)
>   4: clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3548)
>   5: clojure.lang.Compiler.analyzeSeq(Compiler.java:6457)
>   6: clojure.lang.Compiler.analyze(Compiler.java:6262)
>   7: clojure.lang.Compiler.analyze(Compiler.java:6223)
> 
> ; Evaluation aborted.
> user> 
> 
> -- 
> 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
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad!

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