Re: method combinations
- From: Jack Unrue <no.spam@xxxxxxxxxxx>
- Date: Tue, 18 Jul 2006 02:34:36 GMT
On Mon, 17 Jul 2006 19:01:49 -0700, Ari Krupnik <ari@xxxxxxxx> wrote:
(defclass dynamic ()
(slot-a :reader a)
(slot-b :reader b)
(defmethod c ((dy dynamic))
;expensive computations
)
(defmethod d ((dy dynamic))
;expensive computations
)
(defclass precomputed (dynamic)
(slot-c :reader c)
(slot-d :reader d))
(defmethod initialize-instance :after ((pc precomputed) &key c d)
(with-slots (slot-c slot-d) pc
(setf slot-c (c p)) ; tautology
(setf slot-d (d p))))
Ari, I would suggest getting rid of the readers for slot-c and
slot-d. In the c and d methods specialized on precomputed,
call-next-method if necessary to store the result in the
appropriate slot, then return the cached value.
--
Jack Unrue
.
- References:
- method combinations
- From: Ari Krupnik
- method combinations
- Prev by Date: Re: Initial Thoughts on Montezuma
- Next by Date: Re: GNU CLISP 2.39 (2006-07-16)
- Previous by thread: method combinations
- Index(es):
Relevant Pages
|