在常见的 lisp 中将结构传递给宏时出现类型错误

type error passing struct to macro in common lisp

我有这个结构:

(defstruct (endpoint (:constructor create-endpoint (name tags values)))
  name tags values)

还有这个宏:

(defmacro build-get-endpoint (server db-uri db endpoint)
  "constructs a get endpoint that returns all records in the measurement"
  (with-gensyms (uri-sym path-sym query-sym route-sym fields)
    `(let ((,fields (cons "time" (append (endpoint-tags ,endpoint)
                                         (endpoint-values ,endpoint))))
           (,uri-sym (quri:uri ,db-uri))
           (,path-sym (format nil "/~a" ,(endpoint-name endpoint)))
           (,query-sym (format nil "SELECT ~{~a~^, ~} FROM ~a"
                               ,fields ,(endpoint-name endpoint))))

       (setf (quri:uri-path ,uri-sym) "/query")
       (setf (quri:uri-query-params ,uri-sym)
             (list (cons "q" ,query-sym) (cons "db" ,db)))

       (define-route ,server ,path-sym :get
         (defview ,route-sym ()
           (vom:debug "sending query (~a) to influx" (quri:render-uri ,uri-sym))
           (call-influx (dex:get ,uri-sym)
                        (:no-error (body &rest args)
                                   (declare (ignore args))
                                   (respond (parse-get-response body)
                                            :type "application/json" :status 200))))))))

但是当我尝试通过 运行 代码时:

(build-get-endpoint server (start-opts-db-uri starts)
                       (start-opts-db-name starts)
                       (create-endpoint "mood" nil '("value")))

我收到一个类型错误,提示 (create-endpoint "mood" nil '("value")) 不是 ENDPOINT 类型。

我做错了什么?

参见:,(endpoint-name endpoint)

这看起来像是在计算宏展开时的表达式。 endpoint 是代码,尚未评估。