From: Jacek Generowicz
Subject: Switchable feature expression.
Date: 
Message-ID: <tyfissm25xz.fsf@pcepsft001.cern.ch>
Is there a way of writing a feature expression in a way to make it
dependent on the value of a (special) variable?

Or does one have to mess with the features list, to get this to work?
Something along the lines of

  (defun switch-on (&optional switch-on)
    (if switch-on
        (pushnew :switch-on *features*)
        (setq *features* (remove :switch-on *features*))))

in conjunction with

  #+switch-on

From: Barry Margolin
Subject: Re: Switchable feature expression.
Date: 
Message-ID: <dC9ua.15$6b5.691@paloalto-snr1.gtei.net>
In article <···············@pcepsft001.cern.ch>,
Jacek Generowicz  <················@cern.ch> wrote:
>Is there a way of writing a feature expression in a way to make it
>dependent on the value of a (special) variable?

The only thing that #+ and #- look at is the value of *FEATURES*.  You
could certainly provide your own reader macro that's similar, but examines
some other variable, or tests an arbitrary expression, but this isn't what
the built-in ones do.

>Or does one have to mess with the features list, to get this to work?
>Something along the lines of
>
>  (defun switch-on (&optional switch-on)
>    (if switch-on
>        (pushnew :switch-on *features*)
>        (setq *features* (remove :switch-on *features*))))
>
>in conjunction with
>
>  #+switch-on

That seems like a reasonable way to do it.

-- 
Barry Margolin, ··············@level3.com
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Henrik Motakef
Subject: Re: Switchable feature expression.
Date: 
Message-ID: <87issm4vro.fsf@interim.henrik-motakef.de>
Jacek Generowicz <················@cern.ch> writes:

> Is there a way of writing a feature expression in a way to make it
> dependent on the value of a (special) variable?
>
> Or does one have to mess with the features list, to get this to work?
> Something along the lines of
>
>   (defun switch-on (&optional switch-on)
>     (if switch-on
>         (pushnew :switch-on *features*)
>         (setq *features* (remove :switch-on *features*))))
>
> in conjunction with
>
>   #+switch-on

That ought to work, provided that switch-on is called before the
#+swich-on is /read/ (not only before it's executed). I guess you are
basically looking for EVAL-WHEN.

Regards
Henrik
From: james anderson
Subject: Re: Switchable feature expression.
Date: 
Message-ID: <3EB95199.DFC55A8@setf.de>
Jacek Generowicz wrote:
> 
> Is there a way of writing a feature expression in a way to make it
> dependent on the value of a (special) variable?
> 
> Or does one have to mess with the features list, to get this to work?
> Something along the lines of
> 
>   (defun switch-on (&optional switch-on)
>     (if switch-on
>         (pushnew :switch-on *features*)
>         (setq *features* (remove :switch-on *features*))))
> 
> in conjunction with
> 
>   #+switch-on

ist there anything non-portable about

(defParameter cl-user::*?* (first *features*))

#+#.cl-user::*?* t

?
From: Thomas A. Russ
Subject: Re: Switchable feature expression.
Date: 
Message-ID: <ymibrycnnax.fsf@sevak.isi.edu>
Jacek Generowicz <················@cern.ch> writes:

> 
> Is there a way of writing a feature expression in a way to make it
> dependent on the value of a (special) variable?
> 
> Or does one have to mess with the features list, to get this to work?
> ...
> in conjunction with
> 
>   #+switch-on

You have to mess with the features list.

The other thing that you need to remember is that #+ is a READER macro,
so you can't use it to change the way something works once it has been
read into Lisp.  In other words, if you had something like the
following:

(defun foo (n)
  #+debug (print n)
  (* n n))

then the inclusion of the print statement would be decided by the value
of *features* at the time the code was read in.  You could not
dynamically turn the printing on and off by manipulating the value of
the *features* list.  In particular, the following would NOT work:

> (foo 3)
9
> (pushnew :debug *features*)
(:DEBUG ...)
> (foo 4)
4
16
>

because the function isn't read again after the change in *features*.


-- 
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu