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


This message is to encourage the cleanup committee to get to and accept this
proposal and to bring up a related issue having to do with setf generic
functions in CLOS.  

The case covered by the proposal is real (or at least exactly what I want to).
I have a rectangle object that has accessors for retrieving the corner points
and the extent that return two multiple values.  A motivation for doing it this
way versus with structured objects is to please users that are particularly
concerned about consing new structures.  So both types of methods are provided.
(I hacked a version of setf that allows setf of these accessors.)


(defmethod rectangle-min-point ((rect rectangle))
	(make-point min-x min-y))

(defmethod rectangle-min-point* ((rect rectangle))
	(values min-x min-y))

(defmethod (setf* rectangle-min-point*) (min-x min-y (rect rectangle))

The related issue has to do with CLOS.  How does the setf generic function know
how many store values to expect?  This may be a problem with having recombined
the store varables into a single argument list.


Alternatives Solutions in order of preferrence:

1) Change syntax of methods on setf generic function.

(defmethod (setf rectangle-min-point*) (min-x min-y) ((rect rectangle))

2) Extend defgeneric to allow indicating the number of store variables expected
by the setf generic function.

3) Require user to generate setf expander using some provided macro.

(def-generic-setf rectangle-min-point* 2) 

Or the following allows catching some errors at setf expansion.

(def-generic-setf rectangle-min-point* (rect) (min-x min-y))

(defmethod (setf rectangle-min-point*) (min-x min-y (rect rectangle))