From: Dave Love <fx@gnu.org>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Re: use of (defvar <foo>)
Date: Sun, 09 Apr 2006 14:56:23 +0100 [thread overview]
Message-ID: <rzqr746ua2g.fsf@loveshack.ukfsn.org> (raw)
In-Reply-To: <87lkuhdsyb.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 07 Apr 2006 16:45:43 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>From the future's point of view (Emacs-22 and up), placing such defvars
> inside eval-when-compile is a bad practice (in the future it may even fail
> to work since there's nothing that guarantees that the content of
> eval-when-compile is actually compiled rather than just eval'd).
Huh? You don't want it compiled -- that's the point. You're actually
considering changing what eval-when-compile does and breaking more
existing code?? Anyway, the point is that Gnus is supposed to be
supporting Emacs 21 (and XEmacs), the eval-when-compile DTRT
everywhere, and Emacs 22 looks rather a forlorn hope. The
compatibility stuff is typically ugly, but this idiom isn't.
> In Emacs-21 and older, such a defvar will have some undesirable minor
> side-effects (via the load-history) unless it is placed inside an
> eval-when-compile *and* the file is byte-compiled. Indeed placing the
> defvar inside the eval-when-compile has no effect if the file is not
> byte-compiled.
That's the point. Without the wrapper it prevents you using the
load-history mechanisms reliably (as I was trying to do to contribute
to Gnus).
> I'd recommend to not use eval-when-compile since that's what many packages
> have been doing for many years without suffering much (if ever) of the
> occasional side-effects (which only affect unload-feature and sometimes
> C-h v).
Actually, such usage was fixed widely in Emacs 21 because it caused
trouble -- try to test a change by unloading a feature and render your
session unusable.
next prev parent reply other threads:[~2006-04-09 13:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <rzqfykqo6cu.fsf@loveshack.ukfsn.org>
[not found] ` <v9fykq8oiv.fsf@marauder.physik.uni-ulm.de>
[not found] ` <rzqek09mwvl.fsf@loveshack.ukfsn.org>
2006-04-07 19:07 ` use of (defvar <foo>) Reiner Steib
2006-04-07 20:45 ` Stefan Monnier
2006-04-07 23:48 ` Bill Wohler
2006-04-09 13:56 ` Dave Love [this message]
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
2006-04-13 16:51 ` Dave Love
2006-04-08 16:17 ` Richard Stallman
2006-04-09 14:03 ` Dave Love
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=rzqr746ua2g.fsf@loveshack.ukfsn.org \
--to=fx@gnu.org \
--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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.