[Openmcl-devel] Bug in setf/last or not?
gb at clozure.com
Mon Jan 31 11:00:13 UTC 2005
On Mon, 31 Jan 2005, Andrew P. Lentvorski, Jr. wrote:
> I did the following (probably stupid) set of commands:
> HEAP-PACKAGE> (setq h '(1 2 3))
> (1 2 3)
> HEAP-PACKAGE> (setf (last h) nil)
> ;Compiler warnings :
> ; Undeclared free variable H, in an anonymous lambda form.
> ; Undefined function SETF::|COMMON-LISP::LAST|, in an anonymous
> lambda form.
> Is that a bug?
LAST can't be used with SETF (in CLHS terminology, LAST is a "function",
not an "accessor". I'm not sure if that distinction makes it any
easier to remember, but CLHS dictionary entries seem to be consistent
about maintaining that distinction.)
It'd be a little nicer if the warning (and the error message that you
should also have received) refered to the undefined function by the name
(SETF LAST) instead of as SETF::|COMMON-LISP::LAST|; the fact that
SETF function names are mangled and interned in a SETF package is a
gory implementation detail that (ideally) shouldn't be exposed.
More information about the Openmcl-devel