Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!ames!pasteur!ucbvax!decwrl!decvax!ima!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.lisp Subject: Re: (eval-when (load) ... Message-ID: <40511@think.UUCP> Date: 12 May 89 07:04:32 GMT References: <8905120156.AA17446@anaconda.Stanford.EDU> Sender: news@think.UUCP Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 27 In article <8905120156.AA17446@anaconda.Stanford.EDU> rit@ANACONDA.STANFORD.EDU (Jean-Francois Rit) writes: >I think the following statement is true: >(eval-when (load) ) is equivalent to (i.e. at the top-level of >a file. >Am I right? No. It's only equivalent if the file is compiled, and only if the is one which doesn't need to modify the compile-time environment. In order to make it equivalent whether you load the source or the binary, you need to specify (eval-when (eval load) ...). And if the is something like a DEFMACRO, and the macro is used later in that file, the eval-when will prevent the compiler from using it when it encounters the invocation. Unfortunately, there isn't a portable way to write what DEFMACRO expands into when it's processed by COMPILE-FILE. When there's no EVAL-WHEN around the DEFMACRO, the compiler is permitted to define it in such a way that it is only in effect during the compilation process. (eval-when (compile ...) (defmacro ...)) specifies that the macro should be fully defined in the Lisp that is running the compiler, which is not the same thing. Barry Margolin Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar