guile-user
[Top][All Lists]
Advanced

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

Re: help with guile-json inconsistencies


From: Aleix Conchillo Flaqué
Subject: Re: help with guile-json inconsistencies
Date: Mon, 10 Dec 2018 21:18:32 -0800

On Mon, Dec 10, 2018 at 4:38 PM Zelphir Kaltstahl
<address@hidden> wrote:
>
> On 10.12.18 23:16, address@hidden wrote:
> > Therefore, one fix would be to make Vector instead of List to
> > corresponds to Json Array, but maybe this change will cause too much
> > breakage, so I am not sure it is practical.
> >
> > Another way would be to make some other type other than Alist to
> > corresponds to Json Object. If we were in Clojure, it would be Hash
> > Map. I think VHash is a good candidate, but I am not happy with it not
> > having a read/write syntax (Hash Table has the same problem too) which
> > makes it not as flexible as Alist.
>
> I think that is how it is done in Racket, if I am not mistaken.
>
>

This is how it's done in guile-json as well. A json object corresponds
to a hash table in guile-json, otherwise it would not be possible to
work properly internally.

The question was not how to parse json and represent it in guile (that
works well), but how to solve an inconsistency when building a json
object from scheme data types. This was done by converting an alist to
a hash table, but unfortunately it doesn't work well in all cases. So,
the solution is that I will remove the conversion from an alist to an
object, so a user will need to explicitly provide a hash table (e.g.
using alist->hash-table). With this change, the bidirectional mapping
mentioned here will be consistent:

https://github.com/aconchillo/guile-json#usage (without the alist note)

Thanks everyone for all the feedback!

Aleix



reply via email to

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