all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: Drew Adams <drew.adams@oracle.com>, emacs-devel@gnu.org
Subject: Re: print-circle and describe-variable
Date: Tue, 10 Apr 2007 12:13:16 -0400	[thread overview]
Message-ID: <87fy78yzqb.fsf@stupidchicken.com> (raw)
In-Reply-To: <461BAE37.9010208@gmail.com> (Lennart Borgman's message of "Tue\, 10 Apr 2007 17\:33\:11 +0200")

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

>>>> I think you are seeing: 1) the side-effect result of `prin1' printing,
>>>> followed by 2) the returned value, printed normally. (#1=(2) #1#) is the
>>>> former; ((2) (2)) is the latter.
>>> But it is the output of (prin1 (list toto toto)), isn't it?
>>
>> I'm not sure what you mean (by "it" and by "the output", for instance).
>>
>> During the invocation of `prin1', the `print-circle' binding is in effect,
>> so (#1=(2) #1#) is what is printed (by the side effect of `prin1').
>>
>> The binding is finished after the expression evaluation, and that is when
>> the command loop prints the value that is returned by the expression.
>> Printing of this value is thus done using the default value of
>> `print-circle', nil, so you see ((2) (2)).
>
> Yes, but the let binding is in effect when printing the second toto
> too, or? The argument to print1 is (list toto toto).

No, the second list is the result of the `eval-expression', and
print-circle is not in effect there.

Here is another example:

  M-: (setq toto-list (let ((toto (list 2))) (list toto toto))) RET
  M-: (insert (format "%s" (let ((print-circle t)) (prin1 toto-list)))) RET
     => ((2) (2))
  M-: (let ((print-circle t)) (insert (format "%s" (prin1 toto-list)))) RET
     => (#1=(2) #1#)

  parent reply	other threads:[~2007-04-10 16:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-07  0:54 print-circle and describe-variable Lennart Borgman (gmail)
2007-04-07 17:31 ` Richard Stallman
2007-04-09  0:15   ` Stefan Monnier
2007-04-09  1:00     ` Lennart Borgman (gmail)
2007-04-09  7:02       ` Eli Zaretskii
2007-04-09  9:06         ` Lennart Borgman (gmail)
2007-04-09 19:25       ` Stefan Monnier
2007-04-09 19:59         ` Lennart Borgman (gmail)
2007-04-09 23:08           ` Chong Yidong
2007-04-09 23:28             ` Lennart Borgman (gmail)
2007-04-09 23:43               ` Drew Adams
2007-04-10  0:01                 ` Lennart Borgman (gmail)
2007-04-10 15:02                   ` Drew Adams
2007-04-10 15:33                     ` Lennart Borgman (gmail)
2007-04-10 15:50                       ` Drew Adams
2007-04-10 16:32                         ` Lennart Borgman (gmail)
2007-04-10 16:13                       ` Chong Yidong [this message]
2007-04-10  1:00           ` Miles Bader
2007-04-10  2:21         ` Richard Stallman
2007-04-10  2:35           ` Chong Yidong
2007-04-11  4:14             ` Richard Matthew Stallman
2007-04-11  5:16               ` Chong Yidong
2007-04-11 23:04                 ` Richard Matthew Stallman
2007-04-12  9:29                   ` Kim F. Storm
2007-04-13  1:41                     ` Richard Stallman
2007-05-11 16:33                 ` Herbert Euler
2007-04-09 22:52     ` Richard Stallman

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=87fy78yzqb.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=lennart.borgman@gmail.com \
    /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.