Factor and annotate PRINT-UNREADABLE-OBJECT-{2,3}
These two tests check the following from the spec:
If
type
is true, the output from forms is preceded by a brief description of the object's type and a space character. Ifidentity
is true, the output from forms is followed by a space character and a representation of the object's identity, typically a storage address.
Strict reading of the spec implies that that #<NULL >
and #< #x41300>
are correct printouts in cases where, respectively, :TYPE
is true but :IDENTITY
is false, and where :IDENTITY
is true but :TYPE
is false.
I know at least one implementation (CCL) whose maintainers argue that the strictly-standard-compliant variants are ugly, due to the extra space that does not delimit meaningful data inside the angle brackets, and therefore #<NULL>
and #<#x41300>
are preferable. A further claim is that the spec does not take into account situations where :TYPE
and BODY
are null but :IDENTITY
is true and where :IDENTITY
and BODY
are null but :TYPE
is true, and therefore this is an omission in the spec. Furthermore, it is very unlikely that any existing code depends on this behaviour, as the output of PRINT-UNREADABLE-OBJECT
is meant to be eye candy for human readers (which it is somewhat less of, due to the extra space) and to signal errors in the Lisp reader (which behaviour is kept intact, since the #<
in the beginning is not modified).
I propose to factor out checks for spaces in these two situations into a separate pair of testcases and to annotate these tests with :PRINT-UNREADABLE-OBJECT-EXTRA-SPACE
(and debatably :ANSI-SPEC-PROBLEM
), so an implementation may choose to ignore these tests and willingly not conform to that part of the specification.
I can perform these changes and make a MR if you think that this request is agreeable.