[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro in a servlet

At Tue, 26 Mar 2002 16:13:12 -0500 (EST), "Matt 'LEGO Guy' Jadud" wrote:
> However, I currently find
> myself passing the 'initial-request' to the macro, while I'd rather it was
> pulled from the environment of the servlet.
> 	Currently, I'm doing something like
> 	(define-sytax (foo stx)
> 	  (syntax-case stx ()
> 	   [(_ ir blah blah)
> 	    ;; ^ my 'initial-request' variable
> 	    (syntax
> 	     (more ((blah blah)
> 		    (ho hum))
> 		.... (do-stuff-with ir) ....))])))

Probably you want something like

        (define-sytax (foo stx)
          (syntax-case stx ()
           [(_foo blah blah)
            (with-syntax ([initial-request (datum->syntax-object
                                            (syntax _foo)
                (more ((blah blah)
                       (ho hum))
                  .... (do-stuff-with initial-request) ....)))])))

But beware: such "unhygienic" macros often lead to confusion,
especially if you ever write a macro that expands to a use of `foo'.