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: John Cowan
Subject: Re: help with guile-json inconsistencies
Date: Mon, 10 Dec 2018 16:48:59 -0500

On Mon, Dec 10, 2018 at 3:56 PM Alex Vong <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.
>

That is the approach used by the Chicken json egg
<http://wiki.call-cc.org/eggref/5/json>.  Note that when writing
you can use either a vector of pairs or a hash table to represent
a JSON object, but when reading it is always re-created as
a vector of pairs.  This is portable and eliminates any problems
with readability from within Scheme.

The json egg depends on the packrat egg at
< http://wiki.call-cc.org/eggref/5/packrat> which has no further
dependencies, but it would be easy to replace the packrat
parser with a hand-rolled parser.

-- 
John Cowan          http://vrici.lojban.org/~cowan        address@hidden
If I have seen farther than others, it is because I was looking through a
spyglass with my one good eye, with a parrot standing on my shoulder. --"Y"


> 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.
>
> (Actually, I had been trying to write a reader macro for VHash (w/ or
> w/o the Guile Reader library) but I didn't succeed in doing so because
> of my limited knowledge in how lexing works in Guile.)
>
> > Aleix
>
> Cheers,
> Alex
>


reply via email to

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