在我的类定义中,我希望根据一个槽的值初始化另一个槽。以下是我想做的事情:
(defclass my-class ()
((slot-1 :accessor my-class-slot-1 :initarg slot-1)
(slot-2 :accessor my-class-slot-2 :initform (list slot-1))))
但是,这不能编译:
1 compiler notes:
Unknown location:
warning:
This variable is undefined:
SLOT-1
warning:
undefined variable: SLOT-1
==>
(CONS UC-2::SLOT-1 NIL)
Compilation failed.
有办法做到这一点吗?
使用initialize-instance :after
文档here