From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Possible defvar bug Date: Mon, 18 Feb 2013 16:42:57 +0100 Message-ID: <87sj4tpr0e.fsf@thinkpad.tsdh.de> References: <87d2vxr8h6.fsf@thinkpad.tsdh.de> <87obfhy8zc.fsf@gmail.com> <20130218150954.GA4583@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1361202203 21052 80.91.229.3 (18 Feb 2013 15:43:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Feb 2013 15:43:23 +0000 (UTC) Cc: emacs-devel@gnu.org, Jambunathan K , Didier Verna To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 18 16:43:44 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 1U7SsX-0006Ux-84 for ged-emacs-devel@m.gmane.org; Mon, 18 Feb 2013 16:43:41 +0100 Original-Received: from localhost ([::1]:60205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7SsA-0005vB-BY for ged-emacs-devel@m.gmane.org; Mon, 18 Feb 2013 10:43:18 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7Srx-0005kD-I6 for emacs-devel@gnu.org; Mon, 18 Feb 2013 10:43:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7Srs-0002eB-7c for emacs-devel@gnu.org; Mon, 18 Feb 2013 10:43:05 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:54258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7Srs-0002dc-2W for emacs-devel@gnu.org; Mon, 18 Feb 2013 10:43:00 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 9F9AD1A87B7; Mon, 18 Feb 2013 16:42:57 +0100 (CET) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P_qeLzLWuNKY; Mon, 18 Feb 2013 16:42:57 +0100 (CET) X-CHKRCPT: Envelopesender noch tsdh@gnu.org Original-Received: from thinkpad.tsdh.de (tsdh.uni-koblenz.de [141.26.67.142]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 49C9F1A87B6; Mon, 18 Feb 2013 16:42:57 +0100 (CET) Mail-Followup-To: Alan Mackenzie , Didier Verna , Jambunathan K , emacs-devel@gnu.org In-Reply-To: <20130218150954.GA4583@acm.acm> (Alan Mackenzie's message of "Mon, 18 Feb 2013 15:09:54 +0000") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 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:157133 Archived-At: Alan Mackenzie writes: >> 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? Yes, these minimal examples look weired. The real code was a bit more like (let* ((crm-separator ",") ...) ... (function-that-might-read-multiple-values-using-crm)) and `function-that-might-read-multiple-values-using-crm' dispatches if one or multiple separated values are to be read, and then delegates to a read-single-value or read-multiple-values-with-crm function. The latter required crm when being called. The let-binding of `crm-separator' was just meant as a default value in case crm was going to be used, because all LaTeX keyval-options use "," to separate key-value pairs. Bye, Tassilo