unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan <monnier@iro.umontreal.ca>
Cc: Luc Teirlinck <teirllm@dms.auburn.edu>, emacs-devel@gnu.org
Subject: Re: Another bug with the macro counter
Date: Sat, 30 Oct 2004 20:09:07 -0400	[thread overview]
Message-ID: <m1k6t7n492.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <x5r7ngjd1e.fsf@lola.goethe.zz> (David Kastrup's message of "Sat, 30 Oct 2004 20:06:53 +0200")

> 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

  parent reply	other threads:[~2004-10-31  0:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21  1:07 Another bug with the macro counter Luc Teirlinck
2004-10-30  2:38 ` Luc Teirlinck
2004-10-30  3:27   ` Luc Teirlinck
2004-10-30  4:06     ` Stefan
2004-10-30 14:19       ` Luc Teirlinck
2004-10-30 16:12         ` Stefan
2004-10-30 18:06           ` David Kastrup
2004-10-30 23:13             ` Luc Teirlinck
2004-10-31  0:09             ` Stefan [this message]
2004-10-31  7:43               ` David Kastrup
2004-10-31 13:30                 ` Andreas Schwab
2004-10-31 17:05                 ` Stefan
2004-10-31 18:36                   ` David Kastrup
2004-10-31 18:52                     ` Luc Teirlinck
2004-10-30 14:24       ` Luc Teirlinck
2004-10-30 14:51       ` Luc Teirlinck
2004-10-30 21:57         ` Kim F. Storm
2004-10-30 22:04           ` Luc Teirlinck
2004-10-30 22:09             ` Luc Teirlinck
2004-10-30 22:43             ` Kim F. Storm
2004-10-31 21:01           ` Luc Teirlinck
2004-10-31 23:23             ` Kim F. Storm
2004-11-01  7:24           ` Richard Stallman
2004-10-31  9:42       ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1k6t7n492.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=teirllm@dms.auburn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).