GNU bug report logs - #27776
26.0.50; `print-gensym' doesn't work as advertised

Previous Next

Package: emacs;

Reported by: Philipp <p.stephani2 <at> gmail.com>

Date: Thu, 20 Jul 2017 21:32:01 UTC

Severity: minor

Tags: fixed

Found in version 26.0.50

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 27776 <at> debbugs.gnu.org, Philipp Stephani <p.stephani2 <at> gmail.com>
Subject: bug#27776: 26.0.50; `print-gensym' doesn't work as advertised
Date: Thu, 20 Jul 2017 22:21:23 -0400
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Philipp Stephani <p.stephani2 <at> gmail.com> 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




This bug report was last modified 7 years and 171 days ago.

Previous Next


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