Subject: Re: "nested" #- and #+
From: Erik Naggum <erik@naggum.no>
Date: 1999/02/11
Newsgroups: comp.lang.lisp
Message-ID: <3127698648175184@naggum.no>

* Barry Margolin <barmar@bbnplanet.com>
| In the above example, if feature FOO is true the following possibilities
| ensue:
| 
| 1) ZOT is true: The recursive read returns BAR, and this will be tossed
| by the outer #- reader.  It will then proceed to read '#-zot quux', which
| will be skipped because the ZOT feature is true, and will then go on to
| whatever is next.
| 
| 2) ZOT is false: The recursive read will skip over '#+zot bar', then
| return QUUX because the ZOT feature is false.  The outer reader will
| ignore this result
| 
| Notice that the effect is what you said, but how it arrived there is
| different in the two cases.  In one case the outer #- reader performed a
| skip that's performed by the inner #+ reader in the other case.  Note
| that it was important that *READ-SUPPRESS* *not* suppress the
| interpretation of #+ and #- for this to work.

  the way I figured this would work is close to what you describe, but I'm
  trying to figure out what the value of *READ-SUPPRESS* should be at all
  times.  I found it instructive to view it like a hardware signal:

		#+foo #+bar foobar #-bar foo #-foo #+bar bar #-bar nil
		      __    _________    ___             ___
none		_____/  \__/         \__/   \___________/   \__________
#-/#+             [  ]  [  ]         [  ]      [  ]  [  ]      [  ]
                     [----------------------]	        [---]
                           [------]

		            ______                 __    ______    ___
FOO		___________/      \_______________/  \__/      \__/   \
                           [------]               [-------------------]
							[---]

		      __    _________    ___                       ___
BAR		_____/  \__/         \__/   \_____________________/   \
	             [----------------------]                     [---]
					[---]

		                         ___       __    ______    ___
FOO and BAR	________________________/   \_____/  \__/      \__/   \
                                        [---]     [-------------------]
							[---]

  in terms of bindings, *READ-SUPPRESS* is bound to true when the feature-
  expression is false, and to false by the #- and #+ reader macro function
  when reading the feature expression.  the important issue here is that
  the feature expression not read as NIL, but maintains the prevailing
  value when reading the following expression when the feature expression
  is satisfied.

#:Erik
-- 
  Y2K conversion simplified: Januark, Februark, March, April, Mak, June,
  Julk, August, September, October, November, December.