On Mar 2, 8:36 am, Ken Wesson <kwess...@gmail.com> wrote: > On Wed, Mar 2, 2011 at 9:52 AM, Vitaly Peressada <vit...@ufairsoft.com> wrote: > > Ken, > > >> Well for one thing it's printing stuff at macroexpansion time. > > > I don't think this the issue. I have tried this in Clojure's REPL and > > it worked fine > > It would work at the REPL wrapping a single expression because > macroexpansion will occur right before evaluation. But if you used > this in a deployment, or even from the REPL in a nested function or > something, you'd get a bunch of "Working..."s (or whatever) printed > when you first loaded the code, followed by a bunch of "done"s at > assorted times during evaluation, followed by the eventual output of > the thing. > > If you want to flank the evaluation of some code with two printed > messages, both message prints need to be part of the macro's output > rather than one of them being a side effect of the macro's own > expansion.
Indeed. I have an example of similar printing at https://github.com/amalloy/amalloy-utils/blob/master/src/amalloy/utils/debug.clj#L3. You certainly don't want to print at macroexpansion time, for exactly the reasons Ken gives. -- 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