From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: unused local variables Date: Fri, 30 Nov 2007 10:10:31 -0500 Message-ID: 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=us-ascii X-Trace: ger.gmane.org 1196435460 24014 80.91.229.12 (30 Nov 2007 15:11:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2007 15:11:00 +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 16:11:09 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 1Iy7W2-0001uJ-NJ for ged-emacs-devel@m.gmane.org; Fri, 30 Nov 2007 16:10:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy7Vm-0002mY-Kf for ged-emacs-devel@m.gmane.org; Fri, 30 Nov 2007 10:10:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iy7Vi-0002ko-RG for emacs-devel@gnu.org; Fri, 30 Nov 2007 10:10:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iy7Vh-0002iX-5C for emacs-devel@gnu.org; Fri, 30 Nov 2007 10:10:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy7Vg-0002iO-V5 for emacs-devel@gnu.org; Fri, 30 Nov 2007 10:10:33 -0500 Original-Received: from tomts10.bellnexxia.net ([209.226.175.54] helo=tomts10-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iy7Vg-0007Zh-KN for emacs-devel@gnu.org; Fri, 30 Nov 2007 10:10:32 -0500 Original-Received: from toip3.srvr.bell.ca ([209.226.175.86]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071130151031.CEER1733.tomts10-srv.bellnexxia.net@toip3.srvr.bell.ca> for ; Fri, 30 Nov 2007 10:10:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FANi2T0dGN4zh/2dsb2JhbACBWw Original-Received: from bas1-montreal42-1178045665.dsl.bell.ca (HELO pastel.home) ([70.55.140.225]) by toip3.srvr.bell.ca with ESMTP; 30 Nov 2007 10:08:07 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 2435C7F62; Fri, 30 Nov 2007 10:10:30 -0500 (EST) 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: Solaris 8 (1) 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:84357 Archived-At: > 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? Yes. And that's good. E.g. if you want to compile this file with the lexical-scoping version of Emacs that Miles has been working on, this is indispensable. BTW, in the above example, the byte-compiler already complains in the `test' function, so it's not like it's going to make that big a difference. Also dynamic scoping is sufficiently odd and rarely used that it deserve special mention in the code. It's pretty common to mark it with a comment. And code is always better than a comment since it tends to bitrot a bit less quickly. Stefan PS: Another "unused var" warning which we should add (I don't have it in my lock hack yet, tho) is the one that notices when a `defvar' declares a variable which is not used in the file.