Thanks Joel.

But I wasn't able to make it work without requiring explicitly 
clairvoyant.core/trace-forms from my cljs file.


Could you please take a look here: https://github.com/viebel/cljs-explore


Thanks,
Yehonathan

On Friday, 21 November 2014 05:43:34 UTC+2, Joel Holdbrooks  wrote:
> On Monday, November 10, 2014 5:43:50 AM UTC-8, Yehonathan Sharvit wrote:
> > Clairvoyant is really great Joel!
> > I'd like to use the trace-forms inside my project. 
> > 
> > My thought is to have a macro named: dbgfn that will replace defn in the 
> > places where I need to investigate my function calls.
> > 
> > Like this:
> > 
> > (defmacro dbgfn[& args]
> >   `(trace-forms {:tracer clairvoyant.core/default-tracer}
> >     (defn ~@args)))
> > 
> > 
> > and then:
> > (dbgfn foo [a b] 
> >     (+ a b))
> > 
> > 
> > But I am not able to write correctly my dbgfn macro.
> > At run-time, I get the following error:
> > ReferenceError: clairvoyant is not defined 
> > 
> > I found a workaround by adding to to each namespace that uses dbgfn the 
> > following:
> > (:require  [clairvoyant.core :as trace :include-macros true])
> > But it is not convenient.
> >  
> > 
> > Could you help, please?
> > 
> > On Thursday, 23 October 2014 18:37:27 UTC+3, Joel Holdbrooks  wrote:
> > > On Wednesday, October 22, 2014 10:15:13 PM UTC-7, Joel Holdbrooks wrote:
> > > > Clairvoyant, a flexible tracing library for ClojureScript is now 
> > > > version 0.0-43-ga703f4e. Included in this release:
> > > > 
> > > > * Fixed bug which caused anonymous functions to thrown an exception
> > > > * Fixed bug with IPrintWithWriter protocol causing maximum call stack 
> > > > exceeded exceptions
> > > > * Improved display of exit values and function values (you only see the 
> > > > "noise" when you want to)
> > > > * Basic tracing for deftype and defrecord
> > > > * trace-forms can be called without the options map
> > > > 
> > > > I hope these features improve your debugging experience.
> > > > 
> > > > Leiningen dependency: [spellhouse/clairvoyant "0.0-43-ga703f4e"]
> > > > 
> > > > Project homepage: https://github.com/spellhouse/clairvoyant
> > > 
> > > Just noticed there were a few problems with the last release. Please use: 
> > > [spellhouse/clairvoyant "0.0-46-g876ac46"] instead. Sorry!
> 
> My apologies for the late reply. Here's the code:
> 
> ;; trace.clj
> 
> (ns foo.trace
>   (:require [clairvoyant.core]))
> 
> (defmacro defntraced [& defn-body]
>   `(clairvoyant.core/trace-forms
>     (defn ~@defn-body)))
> 
> 
> ;; trace.cljs
> 
> (ns foo.trace
>   (:require-macros
>    (foo.trace :refer [defntraced])))
> 
> (defntraced foo [x y]
>   (+ x y))
> 
> 
> ;; foo.cljs
> 
> (ns foo
>   (:require
>    (foo.trace :include-macros true
>               :refer-macros [defntraced])))
> 
> (defntraced foo [x y]
>   (+ x y))
> 
> 
> Here's a gist for reference: 
> https://gist.github.com/noprompt/7894676fdf6218dd806c

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to