home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!cs.yale.edu!loosemore-sandra
- From: loosemore-sandra@CS.YALE.EDU (Sandra Loosemore)
- Subject: Re: Help with EVAL-WHEN
- In-Reply-To: phil@Xenon.Stanford.EDU's message of Tue, 28 Jul 1992 03: 37:44 GMT
- Message-ID: <1992Jul28.120934.9306@cs.yale.edu>
- Sender: news@cs.yale.edu (Usenet News)
- Nntp-Posting-Host: monad.systemsz.cs.yale.edu
- Organization: staff hacker @ Yale Haskell project
- References: <1992Jul28.033744.13313@CSD-NewsHost.Stanford.EDU>
- Date: Tue, 28 Jul 1992 08:09:21 GMT
- Lines: 20
-
- The problem is that the code nested inside the UNLESS is not at
- top-level. EVAL-WHEN can cause compile-time evaluation only when
- it appears at top-level, so the inner EVAL-WHEN in your code doesn't
- do anything useful. Defining forms such as DEFCONSTANT also have
- no compile-time effect unless they appear at top-level.
-
- A better way to do this kind of conditionalization would be something
- like this:
-
- (eval-when (:compile-toplevel :load-toplevel)
- (if (fboundp 'foo) (pushnew :foo-feature *features*)))
-
- #-:foo-feature
- (progn
- ; code to define your own foo goes here.
- )
-
- Notice that PROGN does pass "top-level-ness" on to its subforms.
-
- -Sandra
-