Macros also allow you to create a dsl to make your code easier to use or understand by obfuscating away bits. For example a macro that times a function call by proxying the call or wrapping a call to defn.
That said, I consider many uses of macros that I’ve seen to be antipatterns that lead to hard to understand code. They should almost always be considered a last resort. > On Oct 19, 2019, at 12:12 PM, Matching Socks <[email protected]> wrote: > > Macros manipulate program symbols. Macros fill the role that is filled by > Perl scripts in the Java world, when they pre-process stuff (a database > schema, or a gui model, for example) into actual Java code before you compile > it. If a task could not be solved by pre-processing the source code before > the program starts to run, then it is not a task for a macro. > > On the bright side, using Java reflection is less tedious in Clojure than it > is in Java. > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/clojure/2c56ec62-9908-40b8-aacc-aecaf157049c%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/E0B8D5A1-AC56-4FD6-BAC9-220E628FC510%40chartbeat.com.
