Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!tank.news.pipex.net!pipex!dish.news.pipex.net!pipex!harlqn.co.uk!harlequin.co.uk!pekka
From: pekka@harlequin.co.uk (Pekka P. Pirinen)
Subject: Re: SET-CAR vs. RPLACA vs. SETF (only) (was Re: ISO/IEC CD 13816 -- ISLisp)
In-Reply-To: mad@math.keio.ac.jp's message of Thu, 21 Dec 1995 09:04:54 GMT
Message-ID: <PEKKA.95Dec27135708@gaspode.harlqn.co.uk>
Lines: 30
Sender: usenet@harlequin.co.uk (Usenet Maintainer)
Organization: Harlequin Ltd, Barrington Hall, Cambridge UK
References: <49u965$948@goanna.cs.rmit.EDU.AU>
	<MAD.95Dec14143551@tanzanite.math.keio.ac.jp>
	<4as2be$ckp@camelot.ccs.neu.edu> <19951215T014159Z@arcana.naggum.no>
	<4b35de$ilh@goanna.cs.rmit.EDU.AU>
	<MAD.95Dec21180454@tanzanite.math.keio.ac.jp>
Date: Wed, 27 Dec 1995 13:57:08 GMT

In article <MAD.95Dec21180454@tanzanite.math.keio.ac.jp> mad@math.keio.ac.jp (MAEDA Atusi) writes:
   (CL's DEFINE-SETF-METHOD is a mess).
   It is much more complicated than DEFSETF, but for what reason?
   DEFSETF is just fine for almost all purposes.  I know that
   DEFINE-SETF-METHOD is necessary when we want to define setf method for
   some place forms such as (LDB ...) and (MASK-FIELD ...), but they are
   all special in that they do not destructively modify specified data
   structure. [...]

   If such special cases are the only purposes for DEFINE-SETF-METHOD,
   then I think it isn't worth having it.  Or is there more obvious
   reason to have it?  If so, enlighten me, please.

I'd say the real reason is that Lisp wizards want access to the
internals so they can leverage off those mechanisms, when they're
extending the language.  DEFINE-SETF-METHOD is only half of it; the
other half is that GET-SETF-METHOD returns the same five values.

In practical terms, this allows writing macros that use _generalized
variables_ for operations more sophisticated than just setting, such
as SHIFTF, ROTATEF, PUSH, POP, and GETF.  It also allows extending the
idea to places such as APPLY, THE, VALUES -- all now part of ANSI.
We've also found ASSOC a useful place, and there was a article in Lisp
Pointers some years ago that suggested a use for QUOTE as a place!  I
notice that we've even used it in the LispWorks sources to implement a
few places that could have been written using DEFSETF, for efficiency
or clarity of code.
-- 
Pekka P. Pirinen
Harlequin Limited, Cambridge, UK
