guile-user
[Top][All Lists]
Advanced

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

Re: Problems with JSON null


From: Aleix Conchillo Flaqué
Subject: Re: Problems with JSON null
Date: Wed, 2 Jan 2019 15:32:22 -0800

On Wed, Jan 2, 2019 at 6:31 AM John Cowan <address@hidden> wrote:
>
> In the current version of guile-json, JSON null 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.

Hi John,

thanks for reporting this. The best way is to report it through github
(still there...) issues
(https://github.com/aconchillo/guile-json/issues), it's easier track,
reference commits, etc.

I think this change makes sense. I just checked and it's how Racket
does it probably because of the reasons you mentioned. Not too worried
about the breaking change this time, it's not that controversial.

If you don't mind I'd really appreciate if you could file a bug on the
link above and we can continue the discussion there.

Thank you!

Aleix



reply via email to

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