2.7 Multiple Value setf

Some functions in CLIM that return multiple values have setf functions associated with them. For example, output-record-position returns the position of an output record as two values that correspond to the x and y coordinates. In order to change the position of an output record, the programmer would like to invoke (setf output-record-position). Normally however, setf only takes a single value with which to modify the specified place. CLIM provides a "multiple value" version of setf that allows an expression that returns multiple values to be used in updating the specified place. In this specification, this facility will be referred to as setf* in the guise of function names such as (setf* output-record-position), even though setf* is not actually a defined form. [annotate]

Note: In connection with this, and the fact that (setf* output-record-position) and friends are Generic Functions, see section B-4 (Multiple Value setf). [edit]-- Alastair Bridgewater 2006-08-22 23:58Z

For example, the modifying function for output-record-position might be called in either of the following two ways: [annotate]

(setf (output-record-position record) (values nx ny))

(setf (output-record-position record1) (output-record-position record2))

The second form works because output-record-position itself returns two values. [annotate]

Some CLIM implementations may not support setf* due to restrictions imposed by the underlying Lisp implementation. In this case, programmers may use special "setter" function instead. In the above example, output-record-set-position is the "setter" function. [annotate]

Note: Are the argument conventions for the "setter" functions defined anywhere in this spec? [edit]-- Alastair Bridgewater 2006-08-22 23:58Z