[hunchentoot-devel] How to pass define-easy-handler symbol?

Toby tobia.conforto at linux.it
Fri Jan 12 15:13:08 UTC 2007


Jeffrey Cunningham wrote:
> Suppose I want to call 'DEFINE-EASY-HANDLER inside another function
> and pass the symbol as an argument. I tried stuff like this:
> 
> (defun some-function (name)
>   (define-easy-handler ((intern name) 
>                         :uri (concatenate 'string name ".html")
>                         :default-request-type :post)
>                        ((formarg :parameter-type :keyword))
>     (html-generator name formarg)))

define-easy-handler is a macro, which means that (intern name) doesn't
get evaluated unless/until the macro sees fit.

Try defining some-function as a macro too:

(defmacro some-function (name)
  `(define-easy-handler (,(intern name) 
                         :uri ,(concatenate 'string name ".html")
                         :default-request-type :post)
                        ((formarg :parameter-type :keyword))
     (html-generator ,name formarg)))


Toby



More information about the Tbnl-devel mailing list