> one is told to avoid macros as long as possible.

I've heard this before, but I believe it's intended to be interpreted
differently. I believe, it's meant to more like "don't use them unless
you need them", which some people translate into "avoid them". I have
heard, as a rule of thumb, that less than 5% of your code should be
macros. That's not to suggest they shouldn't be used, but rather to be
selective when using them. There are probably some people who love
them so much they're using them when it's not needed - resulting in
code being more complex than needed, therefore difficult to maintain.

> 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

Very true.

> any way of teasing out when macros are ok?

I try writing code without macros, first, then I look at my code and
ask myself a few questions:

1. Can I create a macro which would make my code shorter and more
readable/mainatainable?
2. Are there areas in my code where performance matters and macro
logic could help in that regard?
   * This one's tricky since you really need to understand when
evaluations occur and if added complexity causes bad operations or
poor sequencing.

Recently I've been discovering that some macro's in a more verbose/
uglier/non-idiomatic, yet strategically structured form can sometimes
create 30 - 40% in run time savings. So for me, I've been challenging
my dependency upon the idiomatic, to see if I can improve things. *I
KNOW, I KNOW - Can you believe it? - Idiomatic code may not always be
the best way! *

^_^

Tim




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