GNU bug report logs -
#44155
Print integers as characters
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 22 Oct 2020 21:12:01 UTC
Severity: normal
Tags: fixed, patch
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
reopen 44155
stop
I don't mind the basic idea, but I'm reopening the bug since it looks like there is some unfinished business. Hope you don't mind.
> When t, print characters from integers that represent a character.
In what way does 't' suggest a character? Wouldn't something like 'character' be more suggestive?
The variable isn't named 'print-integers-as-chars'.
> When a number 16, print non-negative integers in the hexadecimal format.
Doesn't work for bignums:
(let ((integer-output-format 16))
(print 394583945873948753948539845))
394583945873948753948539845
This must be a bug since there is no reason why bignums should be treated specially. In general we try hard not to.
Since there is a read syntax for binary and octal numbers as well, why not permit 2 and 8?
(And why not print negative numbers in the selected radix?)
And C0/C1 controls aren't printed well:
(let ((integer-output-format t))
(print 10)
(print 127))
?
?^?
I strongly suggest that the controls that have special escapes, like \n, use them. What to use for the rest depends on the user's preference really -- for example, 31 might be printed as 31, ?\037, #o37 or #x1f.
Whether to print 32 as ?‹SPACE› or ?\s is a matter of taste.
For that matter, the variable name should perhaps start with 'print-' like other variables that control printing. Maybe we should separate the default radix and print integers as characters? Thus, we'd have:
print-integer-radix -- 2, 8, 16, 10 or nil (which means 10)
print-integers-as-characters -- nil or t
This bug report was last modified 4 years and 258 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.