* bug#27776: 26.0.50; `print-gensym' doesn't work as advertised
@ 2017-07-20 21:30 Philipp
2017-07-20 21:46 ` Philipp Stephani
0 siblings, 1 reply; 5+ messages in thread
From: Philipp @ 2017-07-20 21:30 UTC (permalink / raw)
To: 27776
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.
However, that doesn't seem to be the case, e.g.:
emacs -Q -batch -eval '(let ((print-gensym t)) (print (quote (let ((#1=#:a 1)) #1#))))'
prints
(let ((#:a 1)) #:a)
In GNU Emacs 26.0.50 (build 73, x86_64-apple-darwin16.6.0, NS appkit-1504.83 Version 10.12.5 (Build 16F73))
of 2017-07-20 built on p
Repository revision: 644cdd1aa0a10dbfffa3b9b4c7a97f8cddded0b8
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --with-modules --without-xml2 --without-pop --with-mailutils
--enable-gcc-warnings=yes MAKEINFO=/usr/local/opt/texinfo/bin/makeinfo
'CFLAGS=-O3 -g0' LDFLAGS=-O3'
Configured features:
DBUS NOTIFY ACL GNUTLS ZLIB TOOLKIT_SCROLL_BARS NS MODULES
Important settings:
value of $LANG: de_DE.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm
time-date tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind kqueue cocoa ns multi-tty make-network-process emacs)
Memory information:
((conses 16 208472 8349)
(symbols 48 20232 1)
(miscs 40 33 159)
(strings 32 29516 1081)
(string-bytes 1 777795)
(vectors 16 32977)
(vector-slots 8 669903 8589)
(floats 8 52 295)
(intervals 56 189 0)
(buffers 992 11))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#27776: 26.0.50; `print-gensym' doesn't work as advertised
2017-07-20 21:30 bug#27776: 26.0.50; `print-gensym' doesn't work as advertised Philipp
@ 2017-07-20 21:46 ` Philipp Stephani
2017-07-21 1:17 ` Michael Heerdegen
0 siblings, 1 reply; 5+ messages in thread
From: Philipp Stephani @ 2017-07-20 21:46 UTC (permalink / raw)
To: 27776
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
Philipp <p.stephani2@gmail.com> schrieb am Do., 20. Juli 2017 um 23:32 Uhr:
>
> 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.
[-- Attachment #2: Type: text/html, Size: 909 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#27776: 26.0.50; `print-gensym' doesn't work as advertised
2017-07-20 21:46 ` Philipp Stephani
@ 2017-07-21 1:17 ` Michael Heerdegen
2017-07-21 2:21 ` npostavs
0 siblings, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2017-07-21 1:17 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 27776
Philipp Stephani <p.stephani2@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.
The second problem is that docs speak about recursive data structures
when they mean data structures with shared parts. `print-circle' is not
(only) about recursive (cyclic) structures.
In your example, it doesn't make a difference whether the list is
actually really recursive or not, as long as the same uninterned symbol
appears more than once in it.
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#27776: 26.0.50; `print-gensym' doesn't work as advertised
2017-07-21 1:17 ` Michael Heerdegen
@ 2017-07-21 2:21 ` npostavs
2018-01-31 3:39 ` Noam Postavsky
0 siblings, 1 reply; 5+ messages in thread
From: npostavs @ 2017-07-21 2:21 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 27776, Philipp Stephani
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Philipp Stephani <p.stephani2@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-31 3:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20 21:30 bug#27776: 26.0.50; `print-gensym' doesn't work as advertised Philipp
2017-07-20 21:46 ` Philipp Stephani
2017-07-21 1:17 ` Michael Heerdegen
2017-07-21 2:21 ` npostavs
2018-01-31 3:39 ` Noam Postavsky
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.