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

Jeffrey Cunningham jeffrey at cunningham.net
Sat Jan 13 16:18:29 UTC 2007


On Fri Jan 12, 2007 at 04:13:08PM +0100, Toby wrote:
> 
> 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)))
> 


Hmmm. Unfortunately, it leads to another problem when I try to apply
it to something useful, such as this reduction:

  mapc #'some-function '("foo" "bar")

or even

  (let ((s "foo")) 
    (some-function s)) 

Now the macro sees only the symbol s, not the string it refers to. Is
there a way to get around this? My knowledge of macros is pretty weak.

Thanks,

--Jeff




More information about the Tbnl-devel mailing list