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 #60 received at 9469 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Le Wang <l26wang <at> gmail.com>
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
	Andreas Schwab <schwab <at> linux-m68k.org>, 9469 <at> debbugs.gnu.org
Subject: Re: bug#9469: buffer-local variables seem to remember previous values
Date: Tue, 13 Sep 2011 08:54:58 -0400
> "The special form quote returns its single argument, as written,
> without evaluating it. This provides a way to include constant symbols
> and lists"

> Isn't the first sentence misleading?  It does not *always* return a
> single argument as written.  It does the first time, and memoizes
> subsequently.  Where is the mention of that?

There is no memoization: the quote does not *construct* the object, it
just returns it.

The problem is similar/identical to what happens with immediate strings in C:

char *foo (void)
{
    char *res = "toto\n";
    res[1]++;
    return res;
}

[ modern C tries to fix this problem by the use of "const char*". ]

> Again, pedantically speaking, the information is there.  It's just not
> clear enough to prevent other people falling into this trap in the
> future.

I'd be happy to try and make it more clear to people who aren't familiar
with it (after all, that's the main target audience here), but I'm not
sure how.

Do you have some suggestion about what text to use to make it clear to you?


        Stefan




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

Previous Next


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