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

* Erik Naggum
> (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

* Kent M Pitman <pitman@world.std.com>
| This is cute but doesn't address the issue that (a) the
| maybe-provide-feature form could get more than one form in its body
| [which could almost be dealt with]

  Almost?  Just change &body to &optional and ,@body to ,body, and the
  macro call will refuse to work with more than one "actual" body.

| and (b) there might be spurious #.'s in there [which can't be].

  What is the difference between this and the code without the
  maybe-provide-feature wrapper?

| A failing #-conditional doesn't execute #.

  But since I rely on the specified functionality of #+ and #- to produce
  only whitespace if the conditions are not met, I fail to see what you
  think would make a failing #-condition execute #. in my code.

| So a form that actually does reading and evaluating as it accumulates its
| forms, as would {...} or #{...}  discussed earlier has some advantages.

  But that is not what maybe-provide-feature does.  All it does is make
  sure that it pushes the new feature symbol onto *features* if at least
  one of the conditionally read (with the normal reader functionality)
  expressions are actually read, and not treated as whitespace.

| Btw, that isn't fatal.  Just something I thought I'd mention in defense
| of the conditional notation those people do use.

  I am not quite certaint what you have replied to.

///
-- 
  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.