[Ecls-list] Defstruct question wrt ECL

Stig Sandø stig.sandoe at gmail.com
Mon Feb 16 19:25:32 UTC 2009


Hei,

I have a piece of code that ECL seems to stumble upon. It's been awhile
since I fineread CLHS,
but it is my understanding that the code in question is ok according to the
standard.  The code:

$ cat ecl-issue.lisp
(defstruct rstk
  (make-element #'identity :read-only t))

(defstruct (pq (:include rstk (make-element #'car))))


When using COMPILE-FILE on the the file in ECL it claims to be unable to
expand the DEFSTRUCT
macro for the struct PQ. If the :read-only keyword is removed things compile
fine.


When I read the CLHS wrt :read-only it says:
:read-only *x* When *x* is
*true*<http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#true>,
this specifies that this slot cannot be altered; it will always contain the
value supplied at construction time.
*setf*<http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html#setf>will
not accept the
*reader*<http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#reader>function
for this slot. If
*x* is *false*<http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#false>,
this slot-option has no effect. *X* is not evaluated.
So if I call (MAKE-PQ), ie the construction. my understanding is that the
slot initform should evaluate to #'CAR and that should be the initial value,
and after this the calue cannot be changed.  This also seems to correspond
to other lisps.

Is this an issue with ECL or is there something I am missing?

(Tested with ECL built with gcc 4.0 on OSX 10.5)

Cheers,
Stig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20090216/deba84b4/attachment.html>


More information about the ecl-devel mailing list