GNU bug report logs - #21915
write inconsistent about #nil

Previous Next

Package: guile;

Reported by: Zefram <zefram <at> fysh.org>

Date: Sat, 14 Nov 2015 01:48:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 21915 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#21915; Package guile. (Sat, 14 Nov 2015 01:48:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zefram <zefram <at> fysh.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 14 Nov 2015 01:48:02 GMT) Full text and rfc822 format available.

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

From: Zefram <zefram <at> fysh.org>
To: bug-guile <at> gnu.org
Subject: write inconsistent about #nil
Date: Sat, 14 Nov 2015 01:46:56 +0000
The write function is inconsistent about whether it distinguishes between
#nil and ():

scheme@(guile-user)> '(#nil . a)
$1 = (#nil . a)
scheme@(guile-user)> '(a . #nil)
$2 = (a)

Thee latter behaviour, emitting #nil as if it were (), breaks the usual
write/read round-tripping, and the traditional correspondence between
equal? and matching of written representation.  Admittedly those standards
are not absolute, nor is the extent to which they're expected to hold
documented, but #nil is clearly sufficiently atomic to be the kind of
value to which one would expect them to apply.  For these reasons,
if a consistent behaviour is to be chosen, I think it should be to
consistently distinguish the values.

I think the behaviour should be consistent.  The values should be
distinguished or not without regard to the context in which they arise
within an s-expression.

Whatever is done, even if it's to endorse the inconsistency, the behaviour
should be documented, with rationale.

-zefram




Information forwarded to bug-guile <at> gnu.org:
bug#21915; Package guile. (Fri, 14 May 2021 13:36:01 GMT) Full text and rfc822 format available.

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

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 21915 <at> debbugs.gnu.org, Zefram <zefram <at> fysh.org>
Subject: write inconsistent about #nil
Date: Fri, 14 May 2021 15:34:56 +0200
Hi Zefram,

this is an interesting issue.  Here's a related one:

  https://bugs.gnu.org/48318

I think first of all #nil and '() should actually be equal?
to each other.  After all, both represent the empty list,
and checking structural equality between lists is one of the
common uses of equal?.

It might also be good, in addition, to make the Scheme writer
write (foo . #nil) as (foo . #nil).  The positive is that it
would make bugs in Elisp compatibility easier to see by not
masking the fact that one has #nil instead of () at the end
of a list.  The only negative I can think of is that it would
be mildly annoying to see (foo bar . #nil) where you expected
to see (foo bar), but I don't think that's ever really harmful.

Thoughts?


- Taylan




Information forwarded to bug-guile <at> gnu.org:
bug#21915; Package guile. (Fri, 14 May 2021 21:32:02 GMT) Full text and rfc822 format available.

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

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: 21915 <at> debbugs.gnu.org
Subject: bug#21915: write inconsistent about #nil
Date: Fri, 14 May 2021 23:31:30 +0200
[Message part 1 (text/plain, inline)]
On 14.05.2021 15:34, Taylan Kammer wrote:
> 
> It might also be good, in addition, to make the Scheme writer
> write (foo . #nil) as (foo . #nil).  The positive is that it
> would make bugs in Elisp compatibility easier to see by not
> masking the fact that one has #nil instead of () at the end
> of a list.  The only negative I can think of is that it would
> be mildly annoying to see (foo bar . #nil) where you expected
> to see (foo bar), but I don't think that's ever really harmful.
> 

FWIW here's a tiny patch that realizes this change.

- Taylan
[0001-Don-t-write-foo-.-nil-as-foo.patch (text/plain, attachment)]

Added tag(s) patch. Request was from Taylan Kammer <taylan.kammer <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 15 May 2021 17:48:01 GMT) Full text and rfc822 format available.

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

Previous Next


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