-
Notifications
You must be signed in to change notification settings - Fork 34
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
Change representation of JSON null to symbol null #31
Comments
oops |
The racket json library uses a (json-null) parameter for the null value and an optional argument for most procedures that default to (json-null). That seems like a flexible enough way to do it. |
Too flexible in my opinion. Settle on one, preferably the symbol null, and
stick with it.
… |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the current version of
guile-json
, JSONnull
is represented internally as#nil
. Because of the magic behavior of#nil
, this causes certain problems when trying to discriminate between various internal JSON representations. For example, the programmer will expect(list? j)
to detect a JSON object and(null? j)
to detect an empty JSON object. But these type discriminators are not correct, because they will also return#t
on#nil
. So one must write unidiomatic things like(or (pair? j) ((eq? j '()))
instead of(list? j)
.I suggest (even though it is yet another breaking change) switching to the Scheme symbol
null
. This is portable, printable and rereadable, and not subject to the above problems. It is also what Racket and the Chickenmedea
egg (not thejson
egg) use.The text was updated successfully, but these errors were encountered: