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

cannot encode a dotted pair #48

Open
jsulmont opened this issue May 9, 2023 · 5 comments
Open

cannot encode a dotted pair #48

jsulmont opened this issue May 9, 2023 · 5 comments

Comments

@jsulmont
Copy link

jsulmont commented May 9, 2023

Surprisingly JZON fails to encode a dotted pair, as it assumes it will be able to call length on the cdr

(jzon:stringify '(1 . 2))
@jsulmont
Copy link
Author

jsulmont commented May 9, 2023

as a side note, this issue (together with this one) was uncovered while testing cl-transit, which uses jzon for the JSON part.

@Zulu-Inuoe
Copy link
Owner

Hi - Yes, jzon used to be clever about things like dotted pairs but it was scaled back. Instead it only encodes proper lists.

But I am a fan of "it just works". What do you believe a dotted pair should stringify to?

@jsulmont
Copy link
Author

jsulmont commented May 9, 2023

IMO a dotted pair ought to be encoded as is a list with 2 elements in it, and produce a JSON array of 2 elements

@Zulu-Inuoe
Copy link
Owner

Alright. I appreciate it. I'll look through my notes later to see what past me had to say about this and get back to you.
I don't see the harm now that we don't do fancy alist/plist heuristic detection.

Thanks. And thanks again for the float report - I can't believe I forgot to test the trivial case on that one. Embarrassing.

@jsulmont
Copy link
Author

jsulmont commented May 9, 2023

Alright. I appreciate it. I'll look through my notes later to see what past me had to say about this and get back to you. I don't see the harm now that we don't do fancy alist/plist heuristic detection.

Thanks. And thanks again for the float report - I can't believe I forgot to test the trivial case on that one. Embarrassing.

haha no worries -- these things happen! thank you for contributing JZON

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

2 participants