From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Possible defvar bug Date: Mon, 18 Feb 2013 15:09:54 +0000 Message-ID: <20130218150954.GA4583@acm.acm> References: <87d2vxr8h6.fsf@thinkpad.tsdh.de> <87obfhy8zc.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1361200246 1161 80.91.229.3 (18 Feb 2013 15:10:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Feb 2013 15:10:46 +0000 (UTC) Cc: Jambunathan K , emacs-devel@gnu.org To: Didier Verna Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 18 16:11:08 2013 Return-path: Envelope-to: ged-emacs-devel@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 1U7SN1-0006NP-MT for ged-emacs-devel@m.gmane.org; Mon, 18 Feb 2013 16:11:07 +0100 Original-Received: from localhost ([::1]:50295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7SMh-0006xK-Hm for ged-emacs-devel@m.gmane.org; Mon, 18 Feb 2013 10:10:47 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7SMa-0006wz-Am for emacs-devel@gnu.org; Mon, 18 Feb 2013 10:10:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7SMR-0001zx-Rn for emacs-devel@gnu.org; Mon, 18 Feb 2013 10:10:40 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:20486 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7SMR-0001zC-Gi for emacs-devel@gnu.org; Mon, 18 Feb 2013 10:10:31 -0500 Original-Received: (qmail 35721 invoked by uid 3782); 18 Feb 2013 15:10:28 -0000 Original-Received: from acm.muc.de (pD951A026.dip.t-dialin.net [217.81.160.38]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 18 Feb 2013 16:10:26 +0100 Original-Received: (qmail 4588 invoked by uid 1000); 18 Feb 2013 15:09:54 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157131 Archived-At: On Mon, Feb 18, 2013 at 04:00:28PM +0100, Didier Verna wrote: > Jambunathan K 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).