Commit 74563d90 authored by Erik Huelsmann's avatar Erik Huelsmann
Browse files

Macro hygene: use a generated (anonymous) symbol in macro expansion

The variable name 'next-hooks' potentially (theoretically)
clashes with variable names defined in the body of the expansion.

Don't clash by using an anonymous symbol.
parent af5c58aa
......@@ -83,12 +83,13 @@
a `call-next-hook` to its caller as it is the content
of the rendered page.
(defun ,name (,@args next-hooks)
(flet ((call-next-hook (content context)
(funcall (pop next-hooks) content context next-hooks)))
(push (function ,name) *render-hooks*)))
(let ((next-hooks-sym (gensym)))
(defun ,name (,@args ,next-hooks-sym)
(flet ((call-next-hook (content context)
(funcall (pop ,next-hooks-sym) content context ,next-hooks-sym)))
(push (function ,name) *render-hooks*))))
(defun render-page-with-hooks (content context)
(let ((hooks (reverse (cons #'(lambda (p c next-processors)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment