abcl icon indicating copy to clipboard operation
abcl copied to clipboard

[MOP] `mop:class-slots` doesn't return a set of slot definitions for `structure-class`

Open bohonghuang opened this issue 2 years ago • 1 comments

Hi! I'm trying to introspect structure types through MOP in ABCL. The following code:

(defstruct test
  a b c)

(mapcar #'mop:slot-definition-type (mop:class-slots (find-class 'test)))

is expected to return (A B C), but ABCL emits an error:

The value #(SYSTEM::DEFSTRUCT-SLOT-DESCRIPTION A 0 TEST-A NIL T
            NIL) is not of type #<STANDARD-CLASS SYSTEM:SLOT-DEFINITION {236E0674}>.
   [Condition of type SIMPLE-TYPE-ERROR]

The return value of calling mop:class-slots on a structure-class seems to be a list of vectors that contains slot descriptions, instead of a list of slot definitions.

bohonghuang avatar May 01 '23 08:05 bohonghuang

Different condition on abcl-1.9.3-dev, but still a problem.

CL-USER> (defstruct test
  a b c)
STYLE-WARNING: redefining MAKE-TEST at top level
STYLE-WARNING: redefining TEST-P at top level
STYLE-WARNING: redefining COPY-TEST at top level
TEST
CL-USER> (mapcar #'mop:slot-definition-type (mop:class-slots (find-class 'test)))
; Evaluation aborted on #<STORAGE-CONDITION {47EA3766}>.
CL-USER> (lisp-implementation-version)
"${abcl.version}-git-c3feba71"
"OpenJDK_64-Bit_Server_VM-MacPorts-17.0.8+7"
"aarch64-Mac_OS_X-13.5.1"

easye avatar Aug 18 '23 17:08 easye