From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62653 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: use of (defvar ) Date: Tue, 11 Apr 2006 14:42:58 -0400 Message-ID: <87acas6jvd.fsf-monnier+emacs@gnu.org> References: <87lkuhdsyb.fsf-monnier+emacs@gnu.org> <87bqvas2ls.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 1144781114 13662 80.91.229.2 (11 Apr 2006 18:45:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Apr 2006 18:45:14 +0000 (UTC) Cc: ding@gnus.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 11 20:45:12 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 1FTNrH-0004lA-Ad for ged-emacs-devel@m.gmane.org; Tue, 11 Apr 2006 20:44:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FTNrG-0002HQ-Vy for ged-emacs-devel@m.gmane.org; Tue, 11 Apr 2006 14:44:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FTNr3-0002Es-Nb for emacs-devel@gnu.org; Tue, 11 Apr 2006 14:44:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FTNr0-0002A6-R8 for emacs-devel@gnu.org; Tue, 11 Apr 2006 14:44:44 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FTNr0-00029l-Eg for emacs-devel@gnu.org; Tue, 11 Apr 2006 14:44:42 -0400 Original-Received: from [209.226.175.184] (helo=tomts22-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FTNvt-0008Af-DA; Tue, 11 Apr 2006 14:49:45 -0400 Original-Received: from alfajor ([70.55.147.51]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060411184439.CKEE10262.tomts22-srv.bellnexxia.net@alfajor>; Tue, 11 Apr 2006 14:44:39 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id CF811D8538; Tue, 11 Apr 2006 14:42:58 -0400 (EDT) Original-To: Dave Love In-Reply-To: (Dave Love's message of "Tue, 11 Apr 2006 18:06:55 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:52712 gmane.emacs.gnus.general:62653 Archived-At: >>> 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