From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Newsgroups: gmane.emacs.devel Subject: Re: Another bug with the macro counter Date: Sat, 30 Oct 2004 20:09:07 -0400 Message-ID: References: <200410210107.i9L176B10842@raven.dms.auburn.edu> <200410300238.i9U2cOD02290@raven.dms.auburn.edu> <200410300327.i9U3RWW02355@raven.dms.auburn.edu> <200410301419.i9UEJr002854@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1099181456 17998 80.91.229.6 (31 Oct 2004 00:10:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 31 Oct 2004 00:10:56 +0000 (UTC) Cc: Luc Teirlinck , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 31 02:10:48 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CO3J2-0006ua-00 for ; Sun, 31 Oct 2004 02:10:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CO3Qx-0007Lc-JP for ged-emacs-devel@m.gmane.org; Sat, 30 Oct 2004 20:18:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CO3QR-00075c-UF for emacs-devel@gnu.org; Sat, 30 Oct 2004 20:18:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CO3QR-00075M-Er for emacs-devel@gnu.org; Sat, 30 Oct 2004 20:18:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CO3QR-00074a-93 for emacs-devel@gnu.org; Sat, 30 Oct 2004 20:18:27 -0400 Original-Received: from [206.47.199.141] (helo=simmts12-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CO3HS-0001WI-Io; Sat, 30 Oct 2004 20:09:10 -0400 Original-Received: from empanada.home ([67.71.25.5]) by simmts12-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20041031000909.MUYU1580.simmts12-srv.bellnexxia.net@empanada.home>; Sat, 30 Oct 2004 20:09:09 -0400 Original-Received: by empanada.home (Postfix, from userid 502) id 9210E34D00B; Sat, 30 Oct 2004 20:09:07 -0400 (EDT) Original-To: David Kastrup In-Reply-To: (David Kastrup's message of "Sat, 30 Oct 2004 20:06:53 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin) 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: main.gmane.org gmane.emacs.devel:29201 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29201 > Quieting the byte compiler can probably also be achieved with > (eval-when-compile (defvar edebug-active)) Hopefully such ugly hack doesn't work. (defvar foo) only has an effect when seen by the byte-compiler, so putting it in a `eval-when-compile' is at best pointless. But what I was objecting to is the fact that using (defvar foo) is really telling the byte-compiler: "look, I know you can't see it, but trust me, this is a global or dynamically-bound variable that will be bound at runtime, so don't warn me when I use it". In the case of edebug-active, it is simply not true: it's a variable that might be bound or not, which is why we test it with `boundp'. This case is handled in the byte-compiler by recognizing the (if (boundp 'foo) ...) form so we know that within the first arm of the `if' the variable is bound. We could extend this trick to also recognize (and (boundp 'foo) ...) or even (and ... (boundp 'foo) ...) but it's clearly not necessary in this case. Whether (and (boundp 'foo) foo) is better stylistically than (if (boundp 'foo) foo) is debatable, but I do know that the `if' form is stylistically much better than the use of (defvar foo) or (with-no-warning foo). Stefan