Node: Evaluation of Subforms to Places, Next: Examples of Evaluation of Subforms to Places, Previous: Overview of Places and Generalized Reference, Up: Overview of Places and Generalized Reference
The following rules apply to the evaluation of subforms in a place:
get-setf-expansion.
For all places defined by this specification (e.g., getf, ldb, ...), this order of evaluation is left-to-right.
When a place is derived from a macro expansion, this rule is applied after the macro is expanded to find the appropriate place.
Places defined by using defmacro or
define-setf-expander
use the evaluation order defined by those definitions. For example, consider the following:
(defmacro wrong-order (x y) `(getf ,y ,x))
This following form evaluates place2 first and then place1 because that is the order they are evaluated in the macro expansion:
(push value (wrong-order place1 place2))
push, pushnew, remf, incf, decf, shiftf, rotatef, psetf, pop evaluate all subforms before modifying any of the place locations. setf (in the case when setf has more than two arguments) performs its operation on each pair in sequence. For example, in
(setf place1 value1 place2 value2 ...)
the subforms of place1 and value1 are evaluated, the location
specified by
place1 is modified to contain the value returned by
value1, and
then the rest of the setf form is processed in a like manner.
Rules 2, 3 and 4 cover all standardized macros that manipulate places.