1
(ql:quickload :postmodern)
(defpackage :test-case
  (:use :cl)
  (:import :pomo))
(in-package :test-case)

;; (defclass dao-class (standard-class)
;;   ((direct-keys :initarg :keys :initform nil :reader direct-keys)
;;    (effective-keys :reader dao-keys)
;;    (table-name)
;;    (column-map :reader dao-column-map))
;;   (:documentation "Metaclass for database-access-object classes."))

(defclass definition ()
  ((id :col-type serial :reader definition-id)
   (content :col-type string :initarg :content :accessor definition-content)
   (word :col-type string :initarg :word :accessor definition-word))
  (:metaclass dao-class)
  (:keys id))

(pomo:dao-keys 'definition)
;; => (ID)
;; What I am setting with :keys? a slot in the meta class?

https://gist.github.com/PuercoPop/5850773

4

1 回答 1

3

dao-class有插槽direct-keys,其:initarg名为:keys,因此,如果我正确理解您的问题,答案是:“是的,(:keys id)提供direct-keys元类中插槽的值dao-class。”

编辑更准确地说,在这里,因为措辞不是很清楚......dao-class是一个元类,即一个类,其实例是类本身。在这种情况下, definition是 的实例dao-class它具有插槽direct-keys(在 中声明dao-class),并且该插槽的值definition是从通过:keys选项提供的值初始化的。

于 2013-06-24T15:18:58.457 回答