[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: setf

From: Paul F. Dietz
Subject: [Gcl-devel] Re: setf
Date: Fri, 03 Oct 2003 19:49:47 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Camm Maguire wrote:
Greetings!  Paul, my investigations into the defgeneric and methods
issues is leading me back to the issue of the proper treatment of
'(setf foo) in 'function, 'flet, 'fboundp, etc.  Could you please
briefly summarize for me what is supposed to happen, or what sections
of the spec govern this?  It should be easy to get '(setf foo)
recognized as a function name, but I don't know how it should react
with defsetf -- my feeling is that in the absence of any (defun (setf
foo) ...),

(function '(setf foo)) -> (lambda (x) (setf foo x)),

and to hope that the macroexpansion if any handles the rest.  How far
off is this?

I don't believe defsetf causes a (setf ...) function to be defined
at all.  Instead, it causes a setf *expander* to be defined.  Macros
like SETF would call GET-SETF-EXPANSION to get this expansion.

Example from SBCL:

* (defun foo (x) (car x))

* (defsetf foo rplaca)

* #'(setf foo)

debugger invoked on condition of type UNDEFINED-FUNCTION:
  The function (SETF FOO) is undefined.

Within the debugger, you can type HELP for help. At any command prompt (within
the debugger or not) you can type (SB-EXT:QUIT) to terminate the SBCL
executable. The condition which caused the debugger to be entered is bound to
*DEBUG-CONDITION*. You can suppress this message by clearing

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT   ] Reduce debugger level (leaving debugger, returning to toplevel).
  1: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop.
0] 0

* (macroexpand '(setf (foo x) y))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]