GNU bug report logs - #48318
(ice-9 match) does not allow distinguishing between () and #nil

Previous Next

Package: guile;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sun, 9 May 2021 16:44:02 UTC

Severity: normal

Full log


Message #8 received at 48318 <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 48318 <at> debbugs.gnu.org
Cc: Maxime Devos <maximedevos <at> telenet.be>
Subject: (ice-9 match) does not allow distinguishing between () and #nil
Date: Thu, 13 May 2021 21:14:26 +0200
Hi Maxime,

I believe that match conflating () and #nil is the right thing,
even if the current implementation does it unintentionally.

Those two values should be considered "the same" in most situations
even though (eqv? #nil '()) is false.

In fact I think they should be equal? to each other.  It feels
wrong that (equal? '(foo . #nil) '(foo . ())) evaluates to false,
even though both arguments represent the list '(foo).

Please note that #nil is not ever supposed to be used intentionally.
It's there purely as an Elisp compatibility trick, and the only time
Scheme could should receive it is when receiving data generated by
Elisp code.  For instance when Elisp code generates a list, it would
be terminated by #nil.  (Which is why I think it should equal? '().)

Does that make sense to you?  I'm not sure what the Guile maintainers
would say about (equal? #nil '()).


- Taylan




This bug report was last modified 4 years and 32 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.