I read Jorge Tavares’s article on Macro Patterns a few days ago. I was thinking about replying to mention a few of my favorites:
with-pattern which makes sure a special variable is bound for the body and makes sure the tied resources are released at the end of the block.
- Macros which collect content (usually into a special variable) so they can do something with the content at the end of the close of the macro.
Then, I was working on something tonight when I re-discovered a favorite pattern that I’d forgotten about: Putting multiple wrappers on the same body.
I have now made a macro called
define-web-file which takes a CL-Who or Parenscript body and wraps it up as both a Hunchentoot handler and a
write-to-file wrapper. Now, I can test interactively with Hunchentoot and generate the whole web application when I’m ready.