You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suspect using keyword symbols as slot-descriptors in defstruct doesn't meet HyperSpec and outcome is undefined.
I was trying it as I have a list of keyword symbols I was thinking of using to create a structure with them as slot names.
Corman Lisp handles this except for initializing the the slots when making instances. Setf to slot later works.
e.g.
;; Corman Lisp 3.1 (Patch level 2)
(defstruct book :title :pages)
BOOK
(setq book1 (make-book :title "hoho" :pages 190))
#S( BOOK :TITLE :TITLE :PAGES :PAGES )
book1
#S( BOOK :TITLE :TITLE :PAGES :PAGES )
SBCL initializes as might be expected or hoped for, but with warnings
This is SBCL 1.4.14, an implementation of ANSI Common Lisp.
(defstruct book :title :pages)
STYLE-WARNING: slot name of :TITLE indicates possible syntax error in DEFSTRUCT
STYLE-WARNING: slot name of :PAGES indicates possible syntax error in DEFSTRUCT
BOOK
From https://groups.google.com/d/msg/cormanlisp/_qB2KC4Nw5Q/Sgv6xoZ0CQAJ
The text was updated successfully, but these errors were encountered: