[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

overloading defstruct accessors



   Date: Fri, 15 Jul 88 16:01:08 EDT
   From: fritzson@PRC.Unisys.COM


   The following example can be viewed as an attempt to overload the
   accessor function "get-a" by making it access the "get-a" fields of
   both a "foo" structure and a "bar" structure. 

   -------
   (defstruct (foo (:conc-name ())) get-a)

   (defstruct (bar (:conc-name ()) (:include foo)) get-b)

   (setq afoo (make-foo :get-a 1))

   (setq abar (make-bar :get-a 2 :get-b 3))
   -------
CLtL is pretty clear about this, the structure accessors defined for foo 
should apply to instances of bar. The definition of bar should not obliterate
the definition of the accessor for the foo structure.

Patrick.