From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62607 Path: news.gmane.org!not-for-mail From: Dave Love Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: use of (defvar ) Date: Sun, 09 Apr 2006 14:56:23 +0100 Message-ID: References: <87lkuhdsyb.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1144591008 31842 80.91.229.2 (9 Apr 2006 13:56:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 9 Apr 2006 13:56:48 +0000 (UTC) Cc: ding@gnus.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 09 15:56:45 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 1FSaPF-00052c-Jx for ged-emacs-devel@m.gmane.org; Sun, 09 Apr 2006 15:56:45 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FSaPF-0002K4-4I for ged-emacs-devel@m.gmane.org; Sun, 09 Apr 2006 09:56:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FSaOy-0002Gu-H0 for emacs-devel@gnu.org; Sun, 09 Apr 2006 09:56:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FSaOw-0002G6-4y for emacs-devel@gnu.org; Sun, 09 Apr 2006 09:56:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FSaOw-0002G3-1e for emacs-devel@gnu.org; Sun, 09 Apr 2006 09:56:26 -0400 Original-Received: from [217.158.120.143] (helo=mail.ukfsn.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FSaTM-000722-7Q for emacs-devel@gnu.org; Sun, 09 Apr 2006 10:01:00 -0400 Original-Received: from localhost (84-45-211-153.no-dns-yet.enta.net [84.45.211.153]) by mail.ukfsn.org (Postfix) with ESMTP id A9E48E707D; Sun, 9 Apr 2006 14:53:17 +0100 (BST) Original-Received: from fx by localhost with local (Exim 4.60) (envelope-from ) id 1FSaOt-0003mX-9v; Sun, 09 Apr 2006 14:56:23 +0100 Original-To: Stefan Monnier X-Draft-From: ("nnml:Misc" 345) In-Reply-To: <87lkuhdsyb.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 07 Apr 2006 16:45:43 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) 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:52557 gmane.emacs.gnus.general:62607 Archived-At: Stefan Monnier 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.