Update: the cause of the above weirdness is...

Macros are evaluated at least twice per macro usage (application) during 
compilation. I guess, maybe once for a namespace where it originally occurs and 
at least once per that namespace require. 

So:
 - If there are any side effects in the macro code (e.g. counting how many 
times a macro's been applied), they get executed more times than we'd expect.
 - The same code (macros) gets executed more than once for nothing - during the 
compile.

I've found a workaround for my case, that supports this theory: only generate 
names with pure functions in your macros. So, for a macro like

    (defmacro my-def [x y & args]
     `(def ~(gensym "my-def") (whatever ~x ~y ~@args))

instead of (gensym "my-def"), rather use 

    (apply hashname 'my-def x y args)

where hashname is something like:

    (defn hashname [name & args]
      (symbol (str name (hash (apply str name args)))))

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to