Gnus development mailing list
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Re: use of (defvar <foo>)
Date: Tue, 11 Apr 2006 14:42:58 -0400	[thread overview]
Message-ID: <87acas6jvd.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <rzqu09059e8.fsf@loveshack.ukfsn.org> (Dave Love's message of "Tue, 11 Apr 2006 18:06:55 +0100")

>>> Huh?  You don't want it compiled -- that's the point.
> [Actually, I meant the code rather than the eval result.]
>> By "compiled" I only mean that it goes through the byte-compiler (before
>> being eval'd).
> It goes through the compiler _after_ being evalled, by definition.

No, go check bytecomp.el: the code in eval-when-compile is first compiled;
then the resulting byte-code is evaluated and then the resuting value goes
through the normal processing.

It's this first compilation step before eval'ing which notices the `defvar'
and makes it that (eval-when-compile (defvar foo)) is not a complete noop.
If the contents were not compiled before evaluation, then (eval-when-compile
(defvar foo)) would have no effect whatsoever (i.e. it wouldn't silence the
byte compiler's warnings).

>> If the content of eval-when-compile were not compiled, then
>> (eval-when-compile (defvar foo)) would be 100% equivalent to a nop.

> But it isn't compiled as such.

Judge for yourself:

    (eval-when-compile . (lambda (&rest body)
			   (list 'quote
				 (byte-compile-eval (byte-compile-top-level
						     (cons 'progn body))))))

`byte-compile-eval' is just the evaluation function, but
byte-compile-top-level is the normal byte-compilation function, and I'd argue
that it should be removed (and if it is removed, then (eval-when-compile
(defvar foo)) won't have any silencing effect any more).


        Stefan

  parent reply	other threads:[~2006-04-11 18:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-06 19:24 Dave Love
2006-04-06 19:58 ` Reiner Steib
2006-04-07 11:46   ` Dave Love
2006-04-07 19:07     ` Reiner Steib
2006-04-07 20:45       ` Stefan Monnier
2006-04-07 23:48         ` Bill Wohler
2006-04-09 13:56         ` Dave Love
2006-04-09 14:02           ` David Kastrup
2006-04-11 16:45             ` Dave Love
2006-04-10  0:29           ` Stefan Monnier
2006-04-11 17:06             ` Dave Love
2006-04-11 17:31               ` David Kastrup
2006-04-13 16:44                 ` Dave Love
2006-04-11 18:42               ` Stefan Monnier [this message]
2006-04-13 16:51                 ` Dave Love
2006-04-08 16:17       ` Richard Stallman
2006-04-09 14:03         ` Dave Love
2006-04-11  6:28     ` Lars Magne Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=87acas6jvd.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=ding@gnus.org \
    --cc=emacs-devel@gnu.org \
    /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.
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 NNTP newsgroup(s).