mop for structures
Bug #894241 reported by
sds
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Wishlist
|
Unassigned |
Bug Description
* (defstruct s a)
S
* (sb-pcl:
(#<SB-PCL:
* (sb-pcl:
NIL
I expected (:A) to be returned by the last form; that's what I get with clisp:
[1]> (defstruct s a)
S
[2]> (clos:class-
(#<CLOS:
[3]> (clos:slot-
(:A)
same for reader et al.
SBCL 1.0.50.0.debian
Changed in sbcl: | |
importance: | Undecided → Wishlist |
To post a comment you must log in.
sds <email address hidden> writes:
> Public bug reported: class-direct- slots (find-class 's)) :STRUCTURE- DIRECT- SLOT-DEFINITION A>) slot-definition -initargs (car *))
>
> * (defstruct s a)
> S
> * (sb-pcl:
> (#<SB-PCL:
> * (sb-pcl:
> NIL
I think both this and the answer from clisp are consistent with their
respective implementations of MAKE-INSTANCE: in SBCL, after the above,
(make-instance 's :a 3)
signals an invalid initarg error, while in clisp the same form returns
#S(S :A 3). So I think what's needed is to take a step back and ask
whether either of these behaviours of MAKE-INSTANCE given just a
structure definition is more desireable. I think it's right not to
return S-A as a reader for the slot, because I would expect to be able
to define auxiliary methods on reader functions, but of course the
struct-generated one isn't a generic function.
Getting a real initarg in sbcl can be done with
(defclass s ()
((a :initarg :a))
(:metaclass structure-class))
Cheers,
Christophe