From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: defvars at compile time Date: Fri, 16 Sep 2005 11:48:43 -0400 Message-ID: <87ek7p2f3d.fsf-monnier+emacs@gnu.org> References: <858xxxuupf.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1126886126 15867 80.91.229.2 (16 Sep 2005 15:55:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Sep 2005 15:55:26 +0000 (UTC) Cc: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 16 17:55:22 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EGIUi-0008EA-Dm for ged-emacs-devel@m.gmane.org; Fri, 16 Sep 2005 17:51:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGIUh-0002gU-Nk for ged-emacs-devel@m.gmane.org; Fri, 16 Sep 2005 11:51:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EGISu-0002I8-EH for emacs-devel@gnu.org; Fri, 16 Sep 2005 11:49:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EGISn-0002CN-GW for emacs-devel@gnu.org; Fri, 16 Sep 2005 11:49:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EGISn-0002C3-Du for emacs-devel@gnu.org; Fri, 16 Sep 2005 11:49:21 -0400 Original-Received: from [209.226.175.25] (helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EGISG-00029S-Pu; Fri, 16 Sep 2005 11:48:49 -0400 Original-Received: from alfajor ([70.49.81.204]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050916154845.IAFG26967.tomts5-srv.bellnexxia.net@alfajor>; Fri, 16 Sep 2005 11:48:45 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 6A959D7828; Fri, 16 Sep 2005 11:48:43 -0400 (EDT) Original-To: lekktu@gmail.com In-Reply-To: (Juanma Barranquero's message of "Fri, 16 Sep 2005 15:25:52 +0200") 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:42998 Archived-At: > There's almost zero semantics in `(eval-when-compile (defvar xxx))'. There is: it says someting along the lines of "evaluate (defvar foo) during byte-compilation". Now evaluating (defvar foo) has *zero* effect, so the above code is equivalent to not writing anything. It's only by chance that the byte-compiler actually looks at the contents of `eval-when-compile' (rather than just passing it to `eval') and finds the `defvar' which it interprets then as a kind of "extern" declaration. So when writing the above code, you're relying on undocumented implementation details of the byte-compiler. Also it takes more visual space, and more byte-compile time. The form (defvar foo) was specifically designed as a byte-compiler directive, so please make use of it. Stefan