From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.devel Subject: Re: Is this a bug of Emacs-Lisp? Date: Fri, 17 Feb 2006 18:21:37 +0200 Message-ID: <20060217162137.GA12962@flame.pc> References: <87slqipmde.fsf@emacsfans.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1140239146 6386 80.91.229.2 (18 Feb 2006 05:05:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Feb 2006 05:05:46 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 18 06:05:43 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FAKHn-00016s-L5 for ged-emacs-devel@m.gmane.org; Sat, 18 Feb 2006 06:05:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FAKHm-0000Ik-Td for ged-emacs-devel@m.gmane.org; Sat, 18 Feb 2006 00:05:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FACGr-0007hb-4U for emacs-devel@gnu.org; Fri, 17 Feb 2006 15:32:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FABPe-0005Ba-NZ for emacs-devel@gnu.org; Fri, 17 Feb 2006 14:37:19 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FA8N0-0000TM-07 for emacs-devel@gnu.org; Fri, 17 Feb 2006 11:22:10 -0500 Original-Received: from [62.1.205.36] (helo=igloo.linux.gr) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FA8SN-0008Am-N1 for emacs-devel@gnu.org; Fri, 17 Feb 2006 11:27:44 -0500 Original-Received: from flame.pc (aris.bedc.ondsl.gr [62.103.39.226]) (authenticated bits=128) by igloo.linux.gr (8.13.5/8.13.5/Debian-3) with ESMTP id k1HGLnie000481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 17 Feb 2006 18:21:53 +0200 Original-Received: from flame.pc (flame [127.0.0.1]) by flame.pc (8.13.4/8.13.4) with ESMTP id k1HGLcEg012973; Fri, 17 Feb 2006 18:21:38 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Original-Received: (from keramida@localhost) by flame.pc (8.13.4/8.13.4/Submit) id k1HGLbBZ012972; Fri, 17 Feb 2006 18:21:37 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Original-To: Zhang Wei Content-Disposition: inline In-Reply-To: <87slqipmde.fsf@emacsfans.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.353, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.85, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr 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:50676 Archived-At: On 2006-02-17 13:47, Zhang Wei wrote: > (defun dummy () '(1 . 2)) > > (dummy) > => (1 . 2) > > (setcdr (dummy) 3) > > (dummy) > => (1 . 3) > > Modify the return value of dummy changed it's defination. Is this > a bug of Elisp? If it's not. How does this happen? You are modifying a `literal' cons cell. It's not mandatory for the LISP reader to create a new cons cell every time the (dummy) function runs. If you really want to create a new cons cell every time (dummy) runs, you'll have to explicitly do that in the function: (defun dummy () (copy-tree '(1 . 2))) => dummy (setcdr (dummy) 3) => 3 (dummy) => '(1 . 2)