From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: About self-referential object Date: Fri, 4 Jan 2013 16:55:56 -0800 Message-ID: <3FC0BF0CCCB24BA6820F98E685943F9A@us.oracle.com> References: <20130105073253.c6c5000dfd1a9de6a7c6770c@gmail.com><6BE86BEE127A4EDA936B8C0349D595B6@us.oracle.com> <20130105082439.6fd039019e3ffaee66477208@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1357347372 23077 80.91.229.3 (5 Jan 2013 00:56:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Jan 2013 00:56:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "'Xue Fuqiao'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 05 01:56:28 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TrI3o-0006HY-1Z for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Jan 2013 01:56:28 +0100 Original-Received: from localhost ([::1]:57291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrI3Y-0004EL-Oh for geh-help-gnu-emacs@m.gmane.org; Fri, 04 Jan 2013 19:56:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrI3S-0004E2-O2 for help-gnu-emacs@gnu.org; Fri, 04 Jan 2013 19:56:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrI3Q-0004TW-S0 for help-gnu-emacs@gnu.org; Fri, 04 Jan 2013 19:56:06 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:26140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrI3Q-0004TP-H8 for help-gnu-emacs@gnu.org; Fri, 04 Jan 2013 19:56:04 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r050u2j5020507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 5 Jan 2013 00:56:02 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r050u1h7017016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Jan 2013 00:56:01 GMT Original-Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r050u1AN019880; Fri, 4 Jan 2013 18:56:01 -0600 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 04 Jan 2013 16:56:00 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <20130105082439.6fd039019e3ffaee66477208@gmail.com> Thread-Index: Ac3q2xElgHMSaOHfRsyHlyD6t+EFeAAAZErg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88458 Archived-At: > Emacs detects such recursion and prints `#LEVEL' instead of > recursively printing an object already being printed. For > example, here `#0' indicates a recursive reference to the > object at level 0 of the current print operation. > > But I don't understand. What does `object at level 0 of the > current print operation' mean? It starts to print the object `foo', which is a cons cell whose car is the value of `foo' and whose cdr is (). To print the cons cell it prints `(', followed by the car, followed by `)' - since the cdr is (). Let's assume first that it tries to print the infinite object without any abbreviation. When it starts printing the value of `foo' it is at level 0 (top level). When it tries to print the car of that cons, it needs to print the value of `foo' again, this time at printing level 1: `((foo))'. When it tries to print that third `foo' it is at level 2, and so on. Think of the printing "levels" here as recursive calls to a printing function. To abbreviate, it prints just (#0), meaning a single cons cell with, as its car, the same cons cell, i.e., the object that the printer started out to print. Printing it the long way would be impossible. But it would also be misleading (incorrect), because we would naturally read `(((...(foo)...)))' as being a cons cell with a different cons cell as its car, and that cons cell having another cons cell as its car,... etc. IOW, we would read it incorrectly as nested cons cells, all of which are different. In fact, there is only one cons cell, whose car is itself. Pascal correctly mentioned the _read_ syntax for this kind of thing: #1=(#1#). If you try to read the printed value #0 then an error is raised. See also (elisp) `Circular Objects'.