all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: 30070@debbugs.gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#30070: 27.0.50; cl-print sometimes prints self-referencing objects as #1=#<thing>
Date: Wed, 10 Jan 2018 20:39:03 +0100	[thread overview]
Message-ID: <87fu7dtsfc.fsf@web.de> (raw)


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)






             reply	other threads:[~2018-01-10 19:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 19:39 Michael Heerdegen [this message]
2018-01-10 20:39 ` bug#30070: 27.0.50; cl-print sometimes prints self-referencing objects as #1=#<thing> Stefan Monnier
2018-01-11 14:45   ` Michael Heerdegen
2018-01-11 15:10     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fu7dtsfc.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=30070@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.