From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: unused local variables Date: Fri, 30 Nov 2007 10:59:57 +0100 Message-ID: <85r6i812aq.fsf@lola.goethe.zz> References: <87wss1qd9e.fsf@ambire.localdomain> <20071130.092322.193982611.kazu@iij.ad.jp> <20071130.182726.126856507.kazu@iij.ad.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1196416798 25921 80.91.229.12 (30 Nov 2007 09:59:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2007 09:59:58 +0000 (UTC) Cc: =?utf-8?B?5bGx5pys5ZKM5b2mIEthenUgWWFtYW1vdG8=?= , emacs-devel@gnu.org To: "Juanma Barranquero" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 30 11:00:04 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Iy2fD-0007yq-HN for ged-emacs-devel@m.gmane.org; Fri, 30 Nov 2007 11:00:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy2ex-0006NH-Rc for ged-emacs-devel@m.gmane.org; Fri, 30 Nov 2007 04:59:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iy2es-0006MQ-Dv for emacs-devel@gnu.org; Fri, 30 Nov 2007 04:59:42 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iy2er-0006KJ-5C for emacs-devel@gnu.org; Fri, 30 Nov 2007 04:59:41 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy2er-0006Ju-09 for emacs-devel@gnu.org; Fri, 30 Nov 2007 04:59:41 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iy2eq-0002iy-7a for emacs-devel@gnu.org; Fri, 30 Nov 2007 04:59:40 -0500 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iy2eo-0004dt-Sn; Fri, 30 Nov 2007 04:59:39 -0500 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 27F681C4D3AA; Fri, 30 Nov 2007 10:59:57 +0100 (CET) In-Reply-To: (Juanma Barranquero's message of "Fri, 30 Nov 2007 10:37:55 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:84343 Archived-At: "Juanma Barranquero" writes: > On Nov 30, 2007 10:27 AM, =E5=B1=B1=E6=9C=AC=E5=92=8C=E5=BD=A6 Kazu Yamam= oto wrote: > >> XEmacs warns unused local variables as if they are statically bound. >> Also XEmacs does not warns unused local variables if they are >> also globally defined. > > Are you saying that in > > (defun test () > (if my-dynamic-var > "correct" > "erroneous")) > > (let ((my-dynamic-var t)) > (test)) > > you would force my-dynamic-var to be `defvar'ed to avoid a warning in > the let? I consider this quite reasonable. If my-dynamic-var is used for passing information across function boundaries, it deserves being declared in the same scope. There is one obvious exception: (defun test () (let ((my-variable 3)) (funcall (lambda nil (1+ my-variable))))) Namely, lambda functions using upvalues (well, conceptually as long as we don't have closures). Those are byte-compiled as well and should not complain. --=20 David Kastrup, Kriemhildstr. 15, 44793 Bochum