This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

macro, duplicate definition warning


I'm having a problem defining a syntax-rules macro. I tried to boil it down to essentials in the the 3 files below. Basically a macro expands to an expression containing a call to a utility function, and requiring and using that macro from a file that also requires those same utility functions... leads to a "duplicate definition for 'get-request-param'" warning. (get-request-param is the utility function). This is actually an error for us, because we are using --warn-as-error.

Maybe the answer is just to turn off --warn-as-error? But I'm wondering if there is a better way.

Rob


---------------
macro.scm, defines a macro, whose expansion calls a utility method defined in request.scm.
---------------


(module-name <macro>)
(module-static #t)

(module-export define-web-func)

(require <request>)

(define-syntax define-web-func
  (syntax-rules ()
    ((_ (name req-id res-id param ...) body ...)
     (define (name req-id res-id)
       (let ((param (get-request-param req-id 'param))
             ...)
         body ...)))))


----------------
request.scm, the utility methods (in the real code they are for http stuff)
----------------


(module-name <request>)
(module-static #t)

(define (get-request-param req name)
  (list 'param name))

(define (get-request-attribute req name)
  (list 'attr name))


---------------- use.scm, uses the macro *and* the utility methods ----------------

(module-name <use>)
(module-static #t)

(require <macro>)
(require <request>)

(define-web-func (do-stuff request response a b)
  (display a)
  (newline)
  (display b)
  (newline))


(do-stuff 'req 'res)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]