Subject: [clisp-list] Possible bug: SETF functions generated by DEFSTRUCT

From: Mark Hecht <[email-masked]>
Date: Wed Jun 12 13:10:11 2002

I think I may have found a CLISP bug involving the 'SETF' functions
generated by
DEFSTRUCT for structure components.

Given the following three definitions, in the given order:
   (defun fng ()
     (let ((tmp (make-foo)))
       (setf (foo-x tmp) 'ok)
       tmp))

   (defstruct foo (x nil))

   (defun fok ()
     (let ((tmp (make-foo)))
       (setf (foo-x tmp) 'ok)
       tmp))

Executing the functions gives the following results:
   (fng) ==> *** - EVAL: the function (SETF FOO-X) is undefined
   (fok) ==> #S(FOO :X OK)

There does not appear to be any problem with the 'make' or 'accessor'
functions.
I'm running Clisp 2.28 on Windows NT 4.0

Thank You,
Mark Hecht

---

From: Sam Steingold <[email-masked]>
Date: Wed Jun 12 13:56:05 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Possible bug: SETF functions generated by DEFSTRUCT"
> * Sent on Wed, 12 Jun 2002 16:09:52 -0400
> * Honorable Mark Hecht <[email-masked]> writes:
>
> generated by DEFSTRUCT for structure components.

setf accessors are not required to be functions.
CLISP implements them as macros, and, as with all macros,
they have to be defined before they are first used.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Small languages require big programs, large languages enable small programs.