Macro setf-expanderlet (&rest bindings) &body bodyresults

setf-expanderlet introduces local setf-expanders. This opens possibilities for more complex local setf-expanders than can be handled by Common Lisp's built-in support for local setf functions (which must evaluate all their arguments once from left to right and can only accept one new value at a time).

setf-expanderlet is to define-setf-expander as macrolet is to defmacro. The bindings of setf-expanderlet have much the same semantics as their counterparts in macrolet, except the job of each expander is to return a setf expansion (5 values), not a normal expansion (a form).

As an example of what setf-expanderlet can let one accomplish, with-resolved-places is trivially implemented in terms of it.

Implementation note: Surprisingly enough, this implementation of setf-expanderlet is written fully portably. As far as I can tell, the only caveat is that the name of the local setf-expander is unconditionally made a local macro. This macro, if used in a non-place context, simply expands to a form that evaluates the subforms and then reads the place.

In contrast, "real" setf-expanders as defined by define-setf-expander don't affect the semantics of the operator in non-place contexts, which is useful if the operator is a function. However, if the original operator is simple enough that it's implemented as a function, you can probably just use a local setf function anyway so I don't think the aforementioned caveat is very important.