> Public bug reported:
>
> * (defstruct s a)
> S
> * (sb-pcl:class-direct-slots (find-class 's))
> (#<SB-PCL::STRUCTURE-DIRECT-SLOT-DEFINITION A>)
> * (sb-pcl:slot-definition-initargs (car *))
> 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))
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