Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STRINGIFY a class doesn't work with LispWorks 8.0.1 #49

Closed
louis77 opened this issue Aug 10, 2023 · 3 comments
Closed

STRINGIFY a class doesn't work with LispWorks 8.0.1 #49

louis77 opened this issue Aug 10, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@louis77
Copy link
Contributor

louis77 commented Aug 10, 2023

I have a call like this:

(stringify (make-instance 'ping-response :message "pong"))

Class definition:

(defclass ping-response ()
  ((message
    :initarg :message
    :type string)))

I'm getting the error message:

Call to ERROR {offset 152}
  SYSTEM::ESTRING : CONDITIONS::SLOT-MISSING-ERROR
  SYSTEM::EARGS   : (:NAME #<STANDARD-EFFECTIVE-SLOT-DEFINITION OB.API::MESSAGE 82205E0C6B> :INSTANCE #<OB.API::PING-RESPONSE 80100B6223> :CLASS #<STANDARD-CLASS OB.API::PING-RESPONSE 82204D905B> :OPERATION SLOT-BOUNDP :NEW-VALUE NIL)

Call to CLOS::SLOT-BOUNDP-MISSING {offset 188}
  CLOS::WRAPPER   : #(2367 (OB.API::MESSAGE) NIL #<STANDARD-CLASS OB.API::PING-RESPONSE 82204D905B> (#<STANDARD-EFFECTIVE-SLOT-DEFINITION OB.API::MESSAGE 82205E0C6B>) 1)
  CLOS::OBJECT    : #<OB.API::PING-RESPONSE 80100B6223>
  CLOS::SLOT-NAME : #<STANDARD-EFFECTIVE-SLOT-DEFINITION OB.API::MESSAGE 82205E0C6B>

Backtrace:

Call to INVOKE-DEBUGGER
Call to ERROR
Call to CLOS::SLOT-BOUNDP-MISSING
Call to REMOVE-IF-NOT
Call to (METHOD COM.INUOE.JZON:COERCED-FIELDS (STANDARD-OBJECT))
Call to (METHOD COM.INUOE.JZON:WRITE-VALUE (COM.INUOE.JZON:WRITER T))
Call to CLOS::NEXT-METHOD-CALL-2
Call to (METHOD COM.INUOE.JZON:WRITE-VALUE :AROUND (COM.INUOE.JZON:WRITER T))
Call to (HARLEQUIN-COMMON-LISP:SUBFUNCTION (FLET COM.INUOE.JZON::STRINGIFY-TO) STRINGIFY)
Call to STRINGIFY
Call to EVAL
Call to CAPI::CAPI-TOP-LEVEL-FUNCTION
Call to CAPI::INTERACTIVE-PANE-TOP-LOOP
Call to MP::PROCESS-SG-FUNCTION

The corresponding code is in https://github.com/Zulu-Inuoe/jzon/blob/d6428d6602752d44d5b08e9c0a51d31f92aee2ab/src/jzon.lisp#L1134C1-L1135C70 , however I couldn't figure out the reason.

@Zulu-Inuoe Zulu-Inuoe added the bug Something isn't working label Aug 10, 2023
@louis77
Copy link
Contributor Author

louis77 commented Aug 11, 2023

I did a little more research, but I'm not sure if I'm on the right track.

In CLOSER-MOP, there is this definition:

(cl:defmethod slot-boundp-using-class
           ((class standard-class) object (slotd standard-effective-slot-definition))
  (declare (optimize (speed 3) (debug 0) (safety 0)
                     (compilation-speed 0)))
  (slot-boundp-using-class
   (load-time-value (class-prototype (find-class 'cl:standard-class)))
   object
   (slot-definition-name slotd)))

in closer-lispworks.lisp.

When I change the lambda list to

(cl:defmethod slot-boundp-using-class
           ((class cl:standard-class) object (slotd standard-effective-slot-definition))

(adding the cl: package to the class specializer) the error is gone.

See https://github.com/pcostanza/closer-mop/blob/04f2d48b741ffd8c2be343e562cc49d46cce2063/closer-lispworks.lisp#L204.

The issue could be related to this: pcostanza/closer-mop#18.

@Zulu-Inuoe
Copy link
Owner

I read through that thread briefly, and it might be related. But what I find odd is that if you look at all the neighboring methods, they all follow the same exact pattern. The idea is that they specialize the slot-definition related methods to call the symbol ones.
Structurally (to me) they seem identical, so it seems odd that slot-boundp-using-class would be broken and all the others working fine.. Unless they are not

@louis77
Copy link
Contributor Author

louis77 commented Aug 11, 2023

I've opened an issue in the CLOSER-MOP project:
pcostanza/closer-mop#22

since this seems to be unrelated to JZON itself.

@louis77 louis77 closed this as completed Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants