[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile-json 2.0.0 released

From: John Cowan
Subject: Re: guile-json 2.0.0 released
Date: Thu, 13 Dec 2018 11:35:22 -0500

On Thu, Dec 13, 2018 at 9:31 AM Thompson, David <address@hidden>

* They have no read syntax
> * They use a procedural, mutable API
> * They are slower than alists when the number of keys is small, which
> is 99% of the time when dealing with serializing objects

I agree with these objections.

> Why not do something like Racket does and use vectors for JSON arrays
> and alists for JSON objects?

In fact Racket uses hash tables, but it provides a (non-standard) lexical
syntax for them: #hasheq followed by an a-list.

> It's not the ideal API IMO, but this way
> only core data types with read syntax are used and is an improvement
> over using hash tables.

My objection to using vectors for JSON arrays is that they are often built
element by element, which JavaScript arrays support but Scheme vectors
do not.  So in practice you would create a list and then convert it to a

While the same thing is sometimes done with objects, it is more common
for an object to have a reasonably fixed structure, which can be well
represented as a vector of pairs, the vector equivalent of an alist.
When the elements of the object are variable, they can be built up
as an alist and then converted with list->vector.

So given that we are changing the structure anyhow, I recommend this

John Cowan        address@hidden
Even a refrigerator can conform to the XML Infoset, as long as it has
a door sticker saying "No information items inside".  --Eve Maler

reply via email to

[Prev in Thread] Current Thread [Next in Thread]