(defun initform-0 (&rest rest)
(loop for item in rest collect
`(,item :initform 0)))
以上定義是因為 defclass 時如果要定義一堆欄位都是初始值是 0 的,
將其集中起來, 減少重複.
(let ((argument (initform-0 'x 'y 'w 'h 'rowgap 'colgap
'distb 'font 'ychar 'x-magr 'y-magr)))
`(defclass-simple DCSLableAndBlock ()
((style :initform "00")
(text :initform "")
,@argument)))
以上是使用時的範例, 不過實際使用是要加上 eval 或 eval-when 等等
0 意見:
張貼意見