From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Avoiding 'reference to free variable' warnings whilesplittingelisp source files Date: Sat, 23 Mar 2013 11:23:23 -0700 Message-ID: <34FC3C03F8024543AA455B46C30A3AE7@us.oracle.com> References: <20130323090800.172d8df4@gauss> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1364063031 11624 80.91.229.3 (23 Mar 2013 18:23:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Mar 2013 18:23:51 +0000 (UTC) To: "'Stefan Monnier'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 23 19:24:18 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1UJT73-0001Eu-60 for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Mar 2013 19:24:17 +0100 Original-Received: from localhost ([::1]:58299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJT6f-0002SB-HB for geh-help-gnu-emacs@m.gmane.org; Sat, 23 Mar 2013 14:23:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJT6N-0002Ob-Tq for help-gnu-emacs@gnu.org; Sat, 23 Mar 2013 14:23:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJT6M-0004NC-QK for help-gnu-emacs@gnu.org; Sat, 23 Mar 2013 14:23:35 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:37282) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJT6M-0004MJ-Hf for help-gnu-emacs@gnu.org; Sat, 23 Mar 2013 14:23:34 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2NINVxV026886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 23 Mar 2013 18:23:32 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2NINUww018783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 23 Mar 2013 18:23:31 GMT Original-Received: from abhmt112.oracle.com (abhmt112.oracle.com [141.146.116.64]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2NINUnH027300; Sat, 23 Mar 2013 13:23:30 -0500 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 23 Mar 2013 11:23:30 -0700 X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 In-Reply-To: Thread-Index: Ac4n7Lc4MjSNnBfTTGO9YocmzG0MQgAAlH6A X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89695 Archived-At: > > This form defines `foo' but does not initialize it: > > (defvar foo) => foo > > Oops that should be "declares `foo'" since it doesn't define it. It does (Emacs, so far) or it doesn't (Stefan). It depends on what one means by "defining". The node (elisp) `Defining Variables' starts by saying what Emacs means by a "variable definition": it "announces your intention to use a symbol as a global variable." That is probably pretty close to what you mean by "declaring". It does not mention value initialization (which is optional). What you presumably want to point out here is that this (a vacuous `defvar') does not define the variable's _value_. (And it does not define the variable's doc.) But the Emacs approach of calling _any_ `defvar' (whether or not it defines the value and doc) a variable _definition_ is consistent. If you want to identify that defining with "declaring", that would be fine too. But if you want to replace that use of "defining" with "declaring" then please be sure to do so everywhere, and make it clear that from now on "defining" always means declaring _and initializing_. IOW, make clear that a `defvar' that does not specify a value is no longer considered a vacuous "definition" etc. To me, it is clear enough the way Emacs has always spoken: Defining means declaring and optionally value-initializing. That is, a variable definition need not also give the variable a value. A variable definition serves three purposes. First, it informs people who read the code that the symbol is _intended_ to be used a certain way (as a variable). Second, it informs the Lisp system of this, optionally supplying an initial value and a documentation string. Third, it provides information to programming tools such as `etags', allowing them to find where the variable was defined. FWIW - There are currently many, *many* occurrences of "declar" in the Elisp manual, and *none* of them have to do with `defvar' or `defconst'. Over 99% of them have to do with functions and macros, and a few have to do with "customization declarations": `defcustom', `defgroup', and `defface'.