GNU bug report logs - #9469
buffer-local variables seem to remember previous values

Previous Next

Package: emacs;

Reported by: Le Wang <l26wang <at> gmail.com>

Date: Sat, 10 Sep 2011 17:12:01 UTC

Severity: normal

Tags: notabug

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #75 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Helmut Eller <eller.helmut <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#9469: buffer-local variables seem to remember previous values
Date: Tue, 13 Sep 2011 22:42:34 +0200
* Drew Adams [2011-09-13 18:52] writes:

[...]
> 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).

Yes, that's crucial.  Beginners need to understand that read and eval
are separate and what the purpose of each is: read turns text into
s-expressions.  eval "executes" s-expressions; eval is described in
terms of s-expressions and not text.  Also that the reader is not the
only way to construct s-expressions for eval.

[...]
> 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?).

I've never heard of a reader that does what you describe here.  The
reader creates a new list for "'foo" just as for "(quote foo)" or for
"(bar foo)".

(eq (read "'a") (read "'a")) returns nil; all the time.

Just like
(let ((sexp (read "('a 'a)")))
  (eq (car sexp) 
      (cadr sexp)))
is always nil.

The reader interns symbols but lists and vectors are freshly created
(ignoring the #1# syntax for now).  The compiler may coalesce constant
lists that are equal; but don't let us confuse the reader with the
compiler.

Helmut





This bug report was last modified 13 years and 308 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.