Getting error when loading a lisp macro: Error: Class named ENTITY not found. While executing: FIND-CLASS, in process Listener(4)
Getting error when loading a lisp macro: Error: Class named ENTITY not found. While executing: FIND-CLASS, in process Listener(4)
我收到这个错误:
Error: Class named ENTITY not found.
While executing: FIND-CLASS, in process Listener(4).
Type cmd-/ to continue, cmd-. to abort, cmd-\ for a list of available restarts.
If continued: Try finding the class again
Type :? for other options.
当我 load/compile 一个包含这个宏的文件时:
(defmacro def-post-entity (entity)
(let* ((repository-var-name (cl-ddd::repository-var entity))
(base-url (string-downcase (concatenate 'string "/api/" (string entity))))
(progn-statement '(progn)))
(loop
for slot in (ccl:class-slots (find-class entity))
append `(setf (,(ccl:slot-definition-name slot) new-entity)
(cdr (assoc ,(string (ccl:slot-definition-name slot)) params :test #'string=)))
into progn-statement)
`(setf (ningle:route cl::*app* ,base-url :method :post)
(lambda (params)
(let ((new-entity (make-instance ,entity)))
(,progn-statement))))))
据我了解 lisp 宏(我是新手),find-class 没有理由期望实体是 class 名称,它是宏的参数。错误消息表明 find-class 正在执行,但实际上没有。我只是通过 (ql:quickload "filename") 加载包含此宏的文件或直接编译它。
如果能帮助我了解正在发生的事情并修复它,我们将不胜感激。
问题出在这个宏之后,我在这里调用 def-post-entity。它也是一个宏,我忘了那意味着 def-post-entity 也会在那里扩展。
Coredumps 评论帮助我弄明白了。
我收到这个错误:
Error: Class named ENTITY not found. While executing: FIND-CLASS, in process Listener(4). Type cmd-/ to continue, cmd-. to abort, cmd-\ for a list of available restarts. If continued: Try finding the class again Type :? for other options.
当我 load/compile 一个包含这个宏的文件时:
(defmacro def-post-entity (entity)
(let* ((repository-var-name (cl-ddd::repository-var entity))
(base-url (string-downcase (concatenate 'string "/api/" (string entity))))
(progn-statement '(progn)))
(loop
for slot in (ccl:class-slots (find-class entity))
append `(setf (,(ccl:slot-definition-name slot) new-entity)
(cdr (assoc ,(string (ccl:slot-definition-name slot)) params :test #'string=)))
into progn-statement)
`(setf (ningle:route cl::*app* ,base-url :method :post)
(lambda (params)
(let ((new-entity (make-instance ,entity)))
(,progn-statement))))))
据我了解 lisp 宏(我是新手),find-class 没有理由期望实体是 class 名称,它是宏的参数。错误消息表明 find-class 正在执行,但实际上没有。我只是通过 (ql:quickload "filename") 加载包含此宏的文件或直接编译它。
如果能帮助我了解正在发生的事情并修复它,我们将不胜感激。
问题出在这个宏之后,我在这里调用 def-post-entity。它也是一个宏,我忘了那意味着 def-post-entity 也会在那里扩展。
Coredumps 评论帮助我弄明白了。