all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30070: 27.0.50; cl-print sometimes prints self-referencing objects as #1=#<thing>
@ 2018-01-10 19:39 Michael Heerdegen
  2018-01-10 20:39 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Heerdegen @ 2018-01-10 19:39 UTC (permalink / raw)
  To: 30070; +Cc: Stefan Monnier


Hi,

my use case is like this:

--8<---------------cut here---------------start------------->8---
;; -*- lexical-binding: t -*-

(require 'cl-lib)
(require 'cl-print)

(cl-defstruct thing
  thing-object)

(cl-defmethod cl-print-object ((_object thing) stream)
  (princ "#<thing>" stream))

(let ((print-circle t))
  (cl-prin1-to-string
   (letrec ((me (make-thing :thing-object (lambda () me))))
     me)))
--8<---------------cut here---------------end--------------->8---

That gives me "#1=#<thing>".  That's weird because the printed
representation of the thing doesn't refer to itself.  This can happen in
real life: that the thing-object in the example is a closure referencing
the thing itself might be coincidence, so one can't assume that the
printed representation of a self-referential object always includes a
reference to the top-level object.


TIA,

Michael.


In GNU Emacs 27.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2018-01-10 built on drachen
Repository revision: bf38966965384b07621839db892b90932b8754a6
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
System Description: Debian GNU/Linux testing (buster)






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-11 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 19:39 bug#30070: 27.0.50; cl-print sometimes prints self-referencing objects as #1=#<thing> Michael Heerdegen
2018-01-10 20:39 ` Stefan Monnier
2018-01-11 14:45   ` Michael Heerdegen
2018-01-11 15:10     ` Stefan Monnier

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.