[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: load time conditional
- To: Ute Gappa <gappa@ira.uka.de>
- Subject: Re: load time conditional
- From: meehan@Pa.dec.com (Jim Meehan)
- Date: Mon, 24 Jun 91 08:55:55 PDT
- Cc: Info-MCL@cambridge.apple.com
- In-reply-to: Message of Mon, 24 Jun 91 13:02:02 MET DST from Ute Gappa <gappa@ira.uka.de> <9106241113.AA00747@brazil.cambridge.apple.com>
I've tried the following code in MACL 1.3.2 to achieve a
load time conditional defun. This code works fine with
the source file, but not with the compiled 'FASL' file.
Is there another possibility to achieve a load time
conditionalisation?
;File # foo
(eval-when (load eval compile)
#+bar
(defun foo ()
"www")
#-bar
(defun foo ()
"qqqq")
)
Simple. The problem is that the definition of foo is controlled by
a READ-time conditional, #+bar. bar was in *features* when you compiled
the file, so when the compiler called READ to get an expression to
compile, it saw (defun foo () "www").
If you want to use features at runtime, you could always write
(defun foo () (if (member 'bar *features* :test 'eq) "www" "qqq"))
but that's not what features are really intended for.