From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Qs on free variable occurrences Date: Sat, 6 May 2006 07:57:43 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1146927492 14466 80.91.229.2 (6 May 2006 14:58:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 6 May 2006 14:58:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 06 16:58:10 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FcOEU-0004vH-4g for ged-emacs-devel@m.gmane.org; Sat, 06 May 2006 16:58:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FcOEU-0007Qn-5w for ged-emacs-devel@m.gmane.org; Sat, 06 May 2006 10:58:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FcOEG-0007QM-48 for emacs-devel@gnu.org; Sat, 06 May 2006 10:57:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FcOEE-0007Pe-GM for emacs-devel@gnu.org; Sat, 06 May 2006 10:57:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FcOEE-0007PW-5Y for emacs-devel@gnu.org; Sat, 06 May 2006 10:57:54 -0400 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1FcOEc-0007Nk-Gn for emacs-devel@gnu.org; Sat, 06 May 2006 10:58:18 -0400 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id k46Evqpg025648 for ; Sat, 6 May 2006 09:57:52 -0500 Original-Received: from dradamslap (dhcp-amer-csvpn-gw1-141-144-64-219.vpn.oracle.com [141.144.64.219]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k46Evopg018108 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sat, 6 May 2006 08:57:51 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Importance: Normal X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE 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:54006 Archived-At: Resending, as I got no reply. Suppose this variable were not predefined in C. Would the Lisp coding style used be appropriate in that case, or should the variable be declared via `defvar'? Consider variable `minibuffer-history-position', in library simple.el. 1. It is bound (`let') in function `repeat-complex-command'. 2. It is assigned a value at the top level of the file. 3. It is both used (evaluated) and assigned a value in functions `previous-matching-history-element' and `next-history-element'. 4. Byte-compiling the file gives no warning of the variable being used as a free variable (in #3 and #4). This is not a criticism, but a couple of questions. a. Why #4? Is it because the byte-compiler cannot detect these as free occurrences of the variable or is it intentional (TRT)? If the latter, what's the rationale? b. Is this coding style considered good or bad? In particular, should `minibuffer-history-position' be declared a global variable by giving it a defvar? Just trying to learn. Supporting reasons would help me understand. `C-h v' says that this variable is defined in C source code. That would perhaps explain #4. I still wonder about the coding style. Consider my questions in a context where the variable was not predefined in C. Thx.