[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(setf (apply #'accessor ...))
- To: CommonLoops.pa@Xerox.COM
- Subject: (setf (apply #'accessor ...))
- From: Greg Anglin <dganglin@watstat.waterloo.edu>
- Date: Wed, 14 Mar 90 13:08:43 EST
- Redistributed: CommonLoops.pa
Hi --
Suppose I have
(defclass foobar ()
((foo :accessor foo)))
(setf bar (make-instance 'foobar))
Then clearly I can do
(setf (foo bar) 42)
but it seems, at least under MACL 1.2.2 and Rainy Day PCL, that
(setf b (list bar))
(setf (apply #'foo b) 42)
is not permitted.
There are uglier ways to do this that work, but I'd really rather not
resort to them. I am having difficulty with this sort of thing
because the generic function I'm creating takes a number, determined
at runtime, of arguments (as &rest) in addition to the instance being
accessed. The situation is exactly the same as the example given for
#'aref in CLtL p96-97 (1st ed ... still waiting for my copy of 2nd
ed), and it would be nice if setf for generic functions had this
capability as well as CL functions.
Any comments?
Greg Anglin