[Cl-perec-devel] Associations and auxiliary information

Leslie P. Polzer leslie.polzer at gmx.net
Sun Aug 24 11:59:27 UTC 2008


We often want an association to carry extra information about
the relationship. In the shop example, each product in a
basket has a quantity assigned to it via

(defpclass* products-in-basket ()
  ((quantity :type integer-16))
  (:documentation "Specifies the quantity of a product in a basket"))

;; defassociation is used to define 1-1, 1-n, m-n persistent associations
;; referential integrity is kept between the two slots in the two owner classes
(defassociation*
  ((:class basket :slot products-in-basket :type (set products-in-basket))
   (:class products-in-basket :slot basket :type basket)))

That seems a bit clumsy to me.
Is there a reason for not being able to say something like

(defassociation*
  ((:class basket :slot products-in-basket :type (set products-in-basket))
   (:class products-in-basket :slot basket :type basket)))
  (quantity :type integer-16))

?

  Leslie




More information about the cl-perec-devel mailing list