From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: print-circle and describe-variable Date: Tue, 10 Apr 2007 08:02:49 -0700 Message-ID: References: <461AD3DC.6030408@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1176246688 22814 80.91.229.12 (10 Apr 2007 23:11:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Apr 2007 23:11:28 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 11 01:10:41 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HbHss-00030x-H9 for ged-emacs-devel@m.gmane.org; Tue, 10 Apr 2007 17:03:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HbHwo-0004pr-QO for ged-emacs-devel@m.gmane.org; Tue, 10 Apr 2007 11:07:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HbHwl-0004oH-IM for emacs-devel@gnu.org; Tue, 10 Apr 2007 11:07:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HbHwj-0004jM-0I for emacs-devel@gnu.org; Tue, 10 Apr 2007 11:07:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HbHwi-0004jJ-Ts for emacs-devel@gnu.org; Tue, 10 Apr 2007 11:07:48 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HbHsl-0005Yh-O8 for emacs-devel@gnu.org; Tue, 10 Apr 2007 11:03:43 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.186.112]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l3AF3eUu020004 for ; Tue, 10 Apr 2007 09:03:40 -0600 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw3.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l3AE6Xwe005086 for ; Tue, 10 Apr 2007 09:03:39 -0600 Original-Received: from dhcp-amer-csvpn-gw1-141-144-66-210.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 2603183011176217372; Tue, 10 Apr 2007 08:02:52 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <461AD3DC.6030408@gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Importance: Normal X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69265 Archived-At: > >> 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'.