On Thu, 28 Oct 2010 12:55:55 -0700 Raoul Duke <rao...@gmail.com> wrote:
> hi, > > not looking to stir up a pot, looking to learn from people's > experience. i've heard that in CL land, one is told to avoid macros as > long as possible. i've heard other folks in the Clojure world say that > if you aren't using macros, then sorta why bother use a Lisp since you > are missing out on one of the most powerful differentiators. then > reading about Conj it sounds like some folks say stay away from macros > if you can. Actually, these aren't really contradictory views. Macros are a powerful feature, and tend to be noted as the thing that sets LISPs apart from other languages. When you need them, nothing else will do the job. But they have downsides. For instance, they aren't a function, so aren't suitable to use as arguments to higher-order functions (another big part of LISP). So if you can do the job with a function, use a function instead. > any way of teasing out when macros are ok? :-) i mean, are they only > ok for the internals of the Clojure system? Last time it came up, there were three basic reasons given: 1) You need to control how many times an argument is evaluated. Commonly, either not at all or once, but possibly more than once. 2) Moving what you can of the computation into the compilation phase. This is a performance hack, so you should be converting functions to macros here. 3) You need it to get the API syntax you want (most commonly, a DSL). <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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