Re: General CL question: get-setf-expansion
"Michał "phoe" Herda (as phoe at disroot dot org)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
W dniu 2025-09-29 18:58, Tim Bradshaw (as tfb at cley dot com) napisał(a): > The question is: does anything usable as a place to setf have to have a > setf expansion, or is it allowed for things just to fall back to > calling some presumed (setf x) function? I don't think it should be > because if it was it would make writing a macro like this much harder, > but I can't work out from the spec. Both LW and SBCL are empirically > fine. CLHS 5.1.2 should give you an answer. Basically, if there are no macros, no symbol macros, no SETF expansions, and no other special cases listed in that chapter, then the "compiler fallback" for (SETF (FOO 1 2 3 ...) BAR) is always (FUNCALL #'(SETF FOO) BAR 1 2 3 ...). This also tells you that, no, a place does not need to have a SETF expansion to be SETFable; if it does not match any of the eight first cases listed in CLHS 5.1.2, then it must have a proper SETF function (and therefore fall under the last, ninth case). https://www.lispworks.com/documentation/HyperSpec/Body/05_ab.htm