unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Philip McGrath <philip@philipmcgrath.com>, 52749@debbugs.gnu.org
Subject: bug#52749: G-expressions don't consistently preserve #nil
Date: Thu, 23 Dec 2021 17:58:40 +0000	[thread overview]
Message-ID: <5624d97b0044f4f7e0dc761a590c857e40fc4ed9.camel@telenet.be> (raw)
In-Reply-To: <23d2ac1d-737d-787c-5535-c816566461dd@philipmcgrath.com>

Philip McGrath schreef op wo 22-12-2021 om 23:25 [-0500]:
> G-expressions currently do not consistently preserve the distinction 
> between #nil and '(), which causes trouble for programs that rely on 
> that distinction. In particular, the issue affects programs that use 
> (guix build json), because that library uses #nil to represent the JSON 
> value `null', whereas it uses '() to represent an empty JSON array.
> 
> The following program exposes the error:
> [
> ;...]
> 
> ; This one fails!
> (check-equal? (gexp->json-string #~'(@ ("k" . #nil)))
>                "{\"k\":null}"
>                "gexp: null in object")

A simpler test:

Compare this:
  (cdr (gexp->approximate-sexp #~("stuff" . #nil)))
  ; output: #nil --- seems like everything is ok?

with:
  (gexp->approximate-sexp #~("stuff" . #nil))
  ; output: ("stuff") --- where did the #nil go?

I think the idea is that, if you construct a list (a b c . #nil)
in elisp, and pass it to Scheme, then Scheme should treat it as a
Scheme list, so it should be printed as (a b c) when using Scheme's
'write' or 'display'.

Greetings,
Maxime.





      parent reply	other threads:[~2021-12-23 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23  4:25 bug#52749: G-expressions don't consistently preserve #nil Philip McGrath
2021-12-23  6:59 ` Maxime Devos
2021-12-25 11:13   ` Maxime Devos
2021-12-27 18:38     ` Philip McGrath
2021-12-27 20:24       ` Maxime Devos
2022-01-03 10:28       ` Maxime Devos
2022-01-03 10:49       ` Maxime Devos
2021-12-23 17:58 ` Maxime Devos [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5624d97b0044f4f7e0dc761a590c857e40fc4ed9.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=52749@debbugs.gnu.org \
    --cc=philip@philipmcgrath.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).