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

Decoding to fluid objects appears to fail in recent versions of SBCL #14

Open
dfmorrison opened this issue Feb 1, 2016 · 4 comments
Open

Comments

@dfmorrison
Copy link

Decoding JSON to fluid objects appears to not work in recent versions of SBCL. For example, the following works fine in SBCL 1.1.0 on Linux (Ubuntu 14.04.3):

* (format t "~@{~A~%~}"
        (asdf:component-version (asdf:find-system :cl-json))
        (lisp-implementation-type)
        (lisp-implementation-version)
        (software-type)
        (software-version)
        (machine-type)
        (machine-version))
0.5.0
SBCL
1.1.0
Linux
3.16.0-50-generic
X86-64
Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
NIL
* (json:with-decoder-simple-clos-semantics
    (json:decode-json-from-string
     "{ \"foo\": [1, 2, 3], \"bar\": true }"))

#<#<JSON:FLUID-CLASS NIL {10055708B3}> {100560D693}>

However, in the latest SBCL, 1.3.2, it fails:

* (format t "~@{~A~%~}"
        (asdf:component-version (asdf:find-system :cl-json))
        (lisp-implementation-type)
        (lisp-implementation-version)
        (software-type)
        (software-version)
        (machine-type)
        (machine-version))
0.5.0
SBCL
1.3.2
Linux
3.16.0-50-generic
X86-64
Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
NIL
* (json:with-decoder-simple-clos-semantics
    (json:decode-json-from-string
     "{ \"foo\": [1, 2, 3], \"bar\": true }"))

debugger invoked on a SB-PCL::SLOTD-INITIALIZATION-ERROR in thread
#<THREAD "main thread" RUNNING {1002A4C6E3}>:
  Invalid SB-MOP:SLOT-DEFINITION initialization: the initialization argument
  :NAME was constant: :FOO.
See also:
  AMOP, Initialization of Slot Definition Metaobjects

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((:METHOD INITIALIZE-INSTANCE :BEFORE (SB-MOP:SLOT-DEFINITION)) #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION {10049862D3}> :NAME :FOO :INITFORM #<unused argument> :INITFUNCTION #<unused argument> :TYPE #<unused argument> :ALLOCATION NIL :INITARGS NIL :DOCUMENTATION NIL) [fast-method]
0] 

It appears to have begun failing in this way at SBCL version 1.2.0 or earlier:

* (format t "~@{~A~%~}"
        (asdf:component-version (asdf:find-system :cl-json))
        (lisp-implementation-type)
        (lisp-implementation-version)
        (software-type)
        (software-version)
        (machine-type)
        (machine-version))
0.5.0
SBCL
1.2.0
Linux
3.16.0-50-generic
X86-64
Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
NIL
* (json:with-decoder-simple-clos-semantics
    (json:decode-json-from-string
     "{ \"foo\": [1, 2, 3], \"bar\": true }"))

debugger invoked on a SB-PCL::SLOTD-INITIALIZATION-ERROR in thread
#<THREAD "main thread" RUNNING {1002BF5053}>:
  Invalid SB-MOP:SLOT-DEFINITION initialization: the initialization argument
  :NAME was constant: :FOO.
See also:
  AMOP, Initialization of Slot Definition Metaobjects

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((:METHOD INITIALIZE-INSTANCE :BEFORE (SB-MOP:SLOT-DEFINITION)) #<SB-MOP:STANDARD-DIRECT-SLOT-DEFINITION #<unbound slot>> :NAME :FOO :INITFORM #<unused argument> :INITFUNCTION #<unused argument> :TYPE #<unused argument> :ALLOCATION NIL :INITARGS NIL :DOCUMENTATION NIL) [fast-method]
0] 
@rpgoldman
Copy link
Contributor

I tried to poke at this, but went astray when trying to inspect the slot definition. It seems to have no name, which either borks the SBCL inspector, or the SLIME interface to the inspector.

@hankhero
Copy link
Owner

hankhero commented Feb 1, 2016

Thanks for reporting, I have quite little time to look at this now sadly.

@JonathanSmith
Copy link

Seems to be a quirk of sbcl. It doesn't like it when you use keyword package for MOP stuff. As a workaround, if you change cl-json:*json-symbols-package* to your own package, it works okay.

@Yehouda
Copy link

Yehouda commented Mar 4, 2020

It also doesn't work on LispWorks (and never did), because LispWorks also does not allow constant symbols as slot names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants