[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: print-circle and describe-variable
From: |
Drew Adams |
Subject: |
RE: print-circle and describe-variable |
Date: |
Tue, 10 Apr 2007 08:02:49 -0700 |
> >> But the result I see is
> >>
> >> (#1=(2) #1#)((2) (2))
> >>
> >> Why are the two printed representations of toto different?
> >
> > 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)).
If you use setq, the command-loop printing of the value also shows (#1=(2)
#1#):
(setq toto (list 2)) => (2)
(setq print-circle t)
(prin1 (setq bar (list toto toto))) => (#1=(2) #1#)(#1=(2) #1#)
C-h v bar => (#1=(2) #1#)(#1=(2) #1#)
(setq print-circle nil)
C-h v bar => ((2) (2))
(prin1 (setq bar (list toto toto))) => ((2) (2))((2) (2))
Both the printout from `prin1' and the printout from the command-loop are
done using the same variable environment, here, so the effect is the same
for both.
You see different printouts using the `let' expression, because one is done
with the non-nil `print-circle' binding in effect, and the other is done
using the default value of `print-circle'.
- Re: print-circle and describe-variable, (continued)
- Re: print-circle and describe-variable, Stefan Monnier, 2007/04/08
- Re: print-circle and describe-variable, Stefan Monnier, 2007/04/09
- Re: print-circle and describe-variable, Lennart Borgman (gmail), 2007/04/09
- Re: print-circle and describe-variable, Chong Yidong, 2007/04/09
- Re: print-circle and describe-variable, Lennart Borgman (gmail), 2007/04/09
- RE: print-circle and describe-variable, Drew Adams, 2007/04/09
- Re: print-circle and describe-variable, Lennart Borgman (gmail), 2007/04/09
- RE: print-circle and describe-variable,
Drew Adams <=
- Re: print-circle and describe-variable, Lennart Borgman (gmail), 2007/04/10
- RE: print-circle and describe-variable, Drew Adams, 2007/04/10
- Re: print-circle and describe-variable, Lennart Borgman (gmail), 2007/04/10
- Re: print-circle and describe-variable, Chong Yidong, 2007/04/10
- Re: print-circle and describe-variable, Miles Bader, 2007/04/09
- Re: print-circle and describe-variable, Richard Stallman, 2007/04/09
- Re: print-circle and describe-variable, Chong Yidong, 2007/04/09
- Re: print-circle and describe-variable, Richard Matthew Stallman, 2007/04/11
- Re: print-circle and describe-variable, Chong Yidong, 2007/04/11
- Re: print-circle and describe-variable, Richard Matthew Stallman, 2007/04/11