From: Alan Mackenzie <acm@muc.de>
To: Didier Verna <didier@didierverna.net>
Cc: Jambunathan K <kjambunathan@gmail.com>, emacs-devel@gnu.org
Subject: Re: Possible defvar bug
Date: Mon, 18 Feb 2013 15:09:54 +0000 [thread overview]
Message-ID: <20130218150954.GA4583@acm.acm> (raw)
In-Reply-To: <mux621pis4z.fsf@didierverna.net>
On Mon, Feb 18, 2013 at 04:00:28PM +0100, Didier Verna wrote:
> Jambunathan K <kjambunathan@gmail.com> wrote:
> > I am certain I don't understand what these paragraphs mean,
> > particularly the second one.
> > lands.
> > ,---- C-h f
> > | If SYMBOL has a local binding, then this form affects the local
> > | binding. This is usually not what you want. Thus, if you need to
> > | load a file defining variables, with this form or with `defconst' or
> > | `defcustom', you should always load that file _outside_ any bindings
> > | for these variables. (`defconst' and `defcustom' behave similarly in
> > | this respect.)
> > `----
> This means that:
> ELISP> (let ((foo 3))
> (defvar foo 1)
> (print foo))
> 3
> ELISP> foo
> *** Eval error *** Symbol's value as variable is void: foo
> ELISP>
> And, no, this is almost never what you want :-) Just like Tassilo
> noticed by accident.
Why would anybody want to defvar a variable inside a let binding which
also defines it, anyway? It may not be totally invalid, but it's
certainly in breach of good taste. I would argue that the current
behaviour _is_ what is wanted, since it alerts one to a probable error.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2013-02-18 15:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 14:40 Possible defvar bug Tassilo Horn
2013-02-18 14:47 ` Jambunathan K
2013-02-18 14:58 ` Tassilo Horn
2013-02-18 15:00 ` Didier Verna
2013-02-18 15:09 ` Alan Mackenzie [this message]
2013-02-18 15:41 ` Thierry Volpiatto
2013-02-18 16:15 ` Drew Adams
2013-02-18 16:26 ` Thierry Volpiatto
2013-02-18 16:40 ` Drew Adams
2013-02-18 16:29 ` Lawrence Mitchell
2013-02-18 15:42 ` Tassilo Horn
2013-02-18 16:19 ` Didier Verna
2013-02-19 1:40 ` Glenn Morris
2013-02-19 15:25 ` Richard Stallman
2013-02-19 17:28 ` Stefan Monnier
2013-02-19 23:29 ` Richard Stallman
2013-02-20 0:08 ` Stefan Monnier
2013-02-20 8:09 ` Tassilo Horn
2013-02-20 14:05 ` Stefan Monnier
2013-02-20 21:36 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130218150954.GA4583@acm.acm \
--to=acm@muc.de \
--cc=didier@didierverna.net \
--cc=emacs-devel@gnu.org \
--cc=kjambunathan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).