Issue PRINT-LENGTH-AND-STRUCTURES
Issue: PRINT-LENGTH-AND-STRUCTURES Forum: Editorial

References: *PRINT-LENGTH*

Category: CLARIFICATION/CHANGE

Edit history: 2004-09-10, initial version by Paul Dietz

Status: For CLiki consideration

Problem Description:

The printer control variable *PRINT-LENGTH* is defined to work on "any object printed with a list-like syntax".

Clarify if this applies to structure objects printed with the default structure printing method, and, if so, clarify if (1) the structure name counts as an element for the purposes of printing, and (2) how the slot names and slot values count as elements.

Current practice:

Assume the form (defstruct foo a b c) has been evaluated, and (defvar *x* (make-foo)). The form

(loop for i from 0 to 3 collect (let ((*print-length* i)) (write-to-string *x*)))

evaluates as follows:

In Lispworks 4.3.6:

("#S(FOO A NIL B NIL C NIL)" "#S(FOO ...)" "#S(FOO A NIL ...)" "#S(FOO A NIL B NIL ...)")

In ACL 6.2:

("#S(...)" "#S(FOO ...)" "#S(FOO :A NIL :B NIL :C NIL)" "#S(FOO :A NIL :B NIL :C NIL)")

In CLISP:

("#S(FOO ...)" "#S(FOO :A NIL :B NIL :C NIL)" "#S(FOO :A NIL :B NIL :C NIL)" "#S(FOO :A NIL :B NIL :C NIL)")

In CMUCL and SBCL:

("#S(FOO ...)" "#S(FOO :A NIL ...)" "#S(FOO :A NIL :B NIL ...)" "#S(FOO :A NIL :B NIL :C NIL)")

In GCL (2.7.0 branch, cvs head 8/2004):

("#S(FOO A NIL B NIL C NIL)" "#S(FOO A NIL B NIL C NIL)" "#S(FOO A NIL B NIL C NIL)" "#S(FOO A NIL B NIL C NIL)")

Cost to Implementors:

Small.

Cost to Users:

May make structures print more verbosely depending on the interpretation.

Cost of Non-Adoption:

Inconsistency.

Benefits:

Avoid an inconsistency.

Aesthetics:

Discussion: