[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
overloading defstruct accessors
- To: fritzson@prc.unisys.com
- Subject: overloading defstruct accessors
- From: Patrick Dussud <edsel!dussud@labrea.stanford.edu>
- Date: Fri, 15 Jul 88 13:37:32 PDT
- Cc: Common-Lisp@sail.stanford.edu
- In-reply-to: fritzson@PRC.Unisys.COM's message of Fri, 15 Jul 88 16:01:08 EDT <8807152001.AA10285@caesar.PRC.Unisys.COM>
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.