(defconstant +logging-enabled+ t)
(defmacro log-message (message)
(when +logging-enabled+
`(err-say ,message)))
(log-message (crazily-expensive-computation))
Like other structures, they can be abused or used with great success. Based on my limited experience with a number of quicklisp-downloaded packages, I have found macros helpful and unnoticeable as macros.Irony: Fewer bracing symbols.
In the next blog post, I am hoping to see how perl 6's macro feature handles the parsing of passed-in code. Specifically, I would like to see an example for do-in-reverse:
(defmacro do-in-reverse (&body commands)
`(progn ,@(reverse commands)))
(do-in-reverse
(princ "First")
(princ "Second")
(princ "Third")))
Prints "ThirdSecondFirst"