I've found at least four ways to define the behavior that happens when
I say '(setf (foo x) y)': DEFUN'ing a function named '(setf foo)',
using the short or long form of DEFSETF, or defining an expander with
DEFINE-SETF-EXPANDER. Plus macros that MACROEXPAND-1 into a SETF'able
place, per CLHS 5.1.2.7.
Can someone give me a little guidance as to when to use which style?
-Peter
--
Peter Seibel
·····@javamonkey.com
In article <··············@localhost.localdomain>,
Peter Seibel <·····@javamonkey.com> wrote:
>I've found at least four ways to define the behavior that happens when
>I say '(setf (foo x) y)': DEFUN'ing a function named '(setf foo)',
>using the short or long form of DEFSETF, or defining an expander with
>DEFINE-SETF-EXPANDER. Plus macros that MACROEXPAND-1 into a SETF'able
>place, per CLHS 5.1.2.7.
>
>Can someone give me a little guidance as to when to use which style?
I recommend trying them in the following order until you get to the one
that meets your needs: a (setf foo) function, short DEFSETF, long DEFSETF,
DEFINE-SETF-EXPANDER. Basically, this is increasing order of complexity.
All these mechanisms exist for historical reasons. The DEF macros were
there first, for the most flexibility. The (setf foo) functions were a
late addition, created to fill a need in CLOS, but they turn out to be the
simplest mechanism (but they can't do everything that the macros can).
--
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.