Subject: bug#27776: 26.0.50; `print-gensym' doesn't work as advertised

From: [email-masked]
Date: Thu, 20 Jul 2017 22:21:23 -0400

Michael Heerdegen <[email-masked]> writes:

> Philipp Stephani <[email-masked]> writes:
>
>>  The docstring of `print-gensym' says:
>>
>>     When the uninterned symbol appears within a recursive data structure,
>>     and the symbol appears more than once, in addition use the #N# and #N=
>>     constructs as needed, so that multiple references to the same symbol are
>>     shared once again when the text is read back.
>>
>> OK, so you could read this as "the numbering is only used for
>> recursive data structures". But I don't understand why; it seems
>> equally appropriate for non-recursive data structures.
>
> AFAICT...I think the docstring of `print-gensym' just fails to say that
> you get that behavior only with print-circle bound non-nil.

I agree.  Compare this note in cltl[1]

     Implementation note: Because the #: syntax does not intern the
     following symbol, it is necessary to use circular-list syntax if
     *print-circle* is not nil and the same uninterned symbol appears
     several times in an expression to be printed. For example, the
     result of

    (let ((x (make-symbol "FOO"))) (list x x))

    would be printed as

    (#:foo #:foo)

    if *print-circle* were nil, but as

    (#1=#:foo #1#)

    if *print-circle* were not nil.

[1]: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node193.html