From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: hash strangeness Date: Tue, 04 Nov 2014 01:57:48 +0000 Message-ID: <87389zralf.fsf@robertthorpeconsulting.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415066302 23586 80.91.229.3 (4 Nov 2014 01:58:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Nov 2014 01:58:22 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Tom Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 04 02:58:16 2014 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 1XlTNu-0000p4-SP for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2014 02:58:15 +0100 Original-Received: from localhost ([::1]:38144 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTNu-0007ni-Hf for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Nov 2014 20:58:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTNd-0007kO-TI for help-gnu-emacs@gnu.org; Mon, 03 Nov 2014 20:58:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlTNX-0002cy-6X for help-gnu-emacs@gnu.org; Mon, 03 Nov 2014 20:57:57 -0500 Original-Received: from outbound-smtp01.blacknight.com ([81.17.249.7]:37760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlTNX-0002cm-0u for help-gnu-emacs@gnu.org; Mon, 03 Nov 2014 20:57:51 -0500 Original-Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp01.blacknight.com (Postfix) with ESMTP id 52945C024E for ; Tue, 4 Nov 2014 01:55:06 +0000 (UTC) Original-Received: (qmail 28777 invoked from network); 4 Nov 2014 01:57:49 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[109.78.243.26]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 4 Nov 2014 01:57:49 -0000 In-Reply-To: (message from Tom on Mon, 3 Nov 2014 21:29:17 +0000 (UTC)) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.7 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:100715 Archived-At: Tom writes: > Barry Margolin alum.mit.edu> writes: >> > >> > I expect '(a b c) to create a new list with these symbols >> > every time it runs. >> >> Why do you expect that? >> >> '(a b c) is short for (quote (a b c)). quote returns its argument, it >> doesn't make a copy of it. > > Okay, but when I write '(a b c) in a function then I'd consider it > an ad hoc list in the current context in the function, not as an object > which outlives the exiting of the function and then returns in the > next invocation, unexpectedly connecting the different invocations. Think about C. Suppose I have: printf("Hello World!\n"); char *bar = "Goodbye"; In C89 and later both of the strings are constants, they're immutable data. If you try to write to one of the characters in "bar" then the program will crash. (In earlier versions of C the string would change, often globally, connecting different invocations of the function.) Emacs Lisp is similar here. The list '(a b c) is made by the interpreter when it's putting the expression into memory. Quote means "quote this thing written by the programmer when the program was written". >> I'm sure somewhere in the Elisp programming manual it mentions that you >> shouldn't use destructive functions on literal lists, like the Common >> Lisp spec does. > > Well, the quoting page doesn't mention it: > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Quoting.html Yes. It should probably say "This provides a way to include constant symbols and constant lists". I didn't understand this until recently either. BR, Robert Thorpe