GNU bug report logs - #32252
[PATCH] %o and %x now format signed numbers

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Mon, 23 Jul 2018 19:14:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


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

From: Andy Moreton <andrewjmoreton <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#32252: [PATCH] %o and %x now format signed numbers
Date: Wed, 25 Jul 2018 11:08:06 +0100
On Tue 24 Jul 2018, Paul Eggert wrote:

> Eli Zaretskii wrote:
>
>> Do we really need to have identical or consistent behavior for fixnums
>> and bignums?  They are different beasts, so the behavior could be
>> different, provided that it makes sense for each of the varieties.
>
> I don't know what inconsistent behavior would make sense here. There's a
> longstanding tradition in Lisp that integer arithmetic just works, and I don't
> see why Emacs would want to fight against that tradition here. Although there
> may be some low-level functions that distinguish between fixnums and bignums
> for efficiency reasons, the vast majority of Lisp functions should not
> distinguish them, and 'format' should be one of those functions.
>> Maybe we should merge the branch first, let the dust settle and let
>> people use the new functionality, then revisit this stuff with more
>> experience on our hands.
>
> This particular patch is not primarily about bignums. It's more about (read
> (printf "#x%x" N)) returning N, which is basic functionality that should work
> even if we never add bignums. The fact that the patch also will make bignums
> easier is just icing on the cake.

It makes things more consistent at a cost of incomatibility with long
standing behaviour, and of making (format "%x") output useless for
humans to read. That is far too high a price for consistency.

> Although I understand the concern about the patch, the concern doesn't seem to
> be warranted, and any compatibility issues can easily be addressed by setting
> binary-as-signed.

No. The default value for this option should preserve backward
compatible behaviour.

    AndyM





This bug report was last modified 2 years and 322 days ago.

Previous Next


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