Subject: Re: #+,#- etc. (Re: Behaviour of #'directory)
From: Erik Naggum <erik@naggum.net>
Date: Thu, 07 Mar 2002 01:46:56 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3224454424845597@naggum.net>

* Kent M Pitman
| Did it allow for multiple cases?  The usual problem that alternatives to
| #+/#- try to address is the desire for #+otherwise.  That is, when you
| have
| 
|  #+(or Genera (and (not Win32) Franz))  (foo)
|  #+(and CLIM (not PDP10)) (bar)
|  #+(or (not CLIM) linux) (baz)
| 
| you sometimes wonder what cases are not handled.  of course you could
| write:
| 
|  #-(or Genera (and (not Win32) Franz) (and CLIM (not PDP10)) (not CLIM) linux)
| 
| but you might forget to edit it if another case is inserted.

  Suppose this is used to support a particular feature, say mumble-frotz.
  Each positive form could then provide the feature.  A minute amount of
  macrology should make it possible to provide a feature more easily.
  Maybe something like this:

(defmacro maybe-provide-feature (feature &body body)
  (when body
    `(progn ,@body (pushnew ,feature *features*))))

  Then we could simply wrap the above example in like this:

(maybe-provide-feature :momble-frotz
  #+(or Genera (and (not Win32) Franz)) (foo)
  #+(and CLIM (not PDP10)) (bar)
  #+(or (not CLIM) linux) (baz))

#-mumble-frotz
  (error "mumble-frotz is unavailable on this system")  ; or whatever

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.