From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#9469: buffer-local variables seem to remember previous values Date: Tue, 13 Sep 2011 11:52:42 -0700 Message-ID: References: <70AD30BE45C847BE828A3E8A71280A8E@us.oracle.com><95CFAF98BEBE4DFAB885B85F02126C57@us.oracle.com> <87ehzktj6b.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1315940027 25805 80.91.229.12 (13 Sep 2011 18:53:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Sep 2011 18:53:47 +0000 (UTC) Cc: 'Lars Magne Ingebrigtsen' , 'Andreas Schwab' , 9469@debbugs.gnu.org, 'Le Wang' To: "'Johan =?UTF-8?Q?Bockg=C3=A5rd'?=" , "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 13 20:53:39 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R3Y70-0000yu-Ij for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2011 20:53:38 +0200 Original-Received: from localhost ([::1]:47687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Y70-0001dV-3f for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Sep 2011 14:53:38 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Y6x-0001dP-IH for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 14:53:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R3Y6w-0006LZ-Hp for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 14:53:35 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R3Y6w-0006LV-Ex for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2011 14:53:34 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R3YBG-0005oc-5f; Tue, 13 Sep 2011 14:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Sep 2011 18:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9469 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 9469-submit@debbugs.gnu.org id=B9469.131594024822303 (code B ref 9469); Tue, 13 Sep 2011 18:58:01 +0000 Original-Received: (at 9469) by debbugs.gnu.org; 13 Sep 2011 18:57:28 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3YAh-0005ng-Tm for submit@debbugs.gnu.org; Tue, 13 Sep 2011 14:57:28 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R3YAe-0005nX-RA for 9469@debbugs.gnu.org; Tue, 13 Sep 2011 14:57:26 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8DIqr5i019744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Sep 2011 18:52:54 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8DIqoUv017108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 Sep 2011 18:52:50 GMT Original-Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8DIqib1029141; Tue, 13 Sep 2011 13:52:44 -0500 Original-Received: from dradamslap1 (/10.159.52.70) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Sep 2011 11:52:43 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87ehzktj6b.fsf@gnu.org> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 Thread-Index: AcxyP11BPe16ZzJmSY6MXMqneenxNwAAGdew X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090206.4E6FA687.0110:SCFMA922111,ss=1,re=-4.000,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 13 Sep 2011 14:58:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:51108 Archived-At: > I think the "as written" bit is mildly confusing, and nearly > falls into this trap: > > In other languages, an expression is text; it has no > other form. In Lisp, an expression is primarily a Lisp > object Indeed. And I repeat that the misunderstanding comes from not knowing or not sufficiently appreciating where those objects come from: what creates them. That is what it would help to repeat/emphasize in the doc (e.g., in the context of things like `quote', at least via a cross-reference). Users need of course to understand that `quote' just returns its argument, but that is not really the problem here, since they can misunderstand "its argument" per the confusion that Johan referred to (text vs Lisp object). What users might not get is that the argument that `quote' receives is a Lisp object that has already been created. That might not be obvious to someone new to Lisp. Especially when written as ', it is easy to misunderstand `quote' as applying to the textual sexp that follows it, and not to a Lisp object. The Lisp reader is kind of in the background of user awareness, so the question of where the Lisp object comes from can mistakenly be answered by thinking that it is `quote' that creates it based on the text/sexp that follows the '. That, I think, is the gotcha that tripped up Le (and he's not alone). In the case of a literal list argument to `quote', e.g. (quote (a b c)), users need to understand that the Lisp reader (or loader) creates the list (a b c). Given that understanding, what can also be missing is that, depending on the Lisp, the Lisp reader might not create a _new_ list each time it encounters the sexp "(a b c)". And in Emacs Lisp it in fact does not create a new list; it reuses a previously created list, if available. (Is that always true for Elisp? What about gc?). This too is not obvious. And we can point out that literal strings are treated differently - the reader does create a new, `eq'-unique string each time it sees "abc". The bottom line is that we should communicate the lesson that you should not depend on the Lisp reader creating a new object each time it reads a sexp. It would be helpful to mention this and explain that the reader's treatment of list sexps is similar to its treatment of symbol sexps (names). The treatment of symbols is perhaps a bit easier to understand because we introduce the notion of obarray, and because a symbol itself has an explicit string representation (its name). At a minimum, then, the manual's treatment of `quote' (and perhaps other things) should reference some doc that explains the Lisp reader behavior well.