|
![](/i/fill.gif) |
On Tue, 25 Jul 2000 17:41:38 +0300, Margus Ramst wrote:
>Alex Vandiver wrote:
>>
>> No -- you're missing the point. The version I wrote leaves a macro, b(),
>> defined after a(foo) closes, which is dependant on what foo was at the time
>> a(foo) was called.
>
>Then how about this:
>
>#macro a(foo)
> #if (foo)
> #declare Switch=1;
> #else
> #declare Switch=0;
> #end
>#end
>
>#if(Switch)
> #macro b()
> // do one thing
> #end
>#else
> #macro b()
> // do another thing
> #end
>#end
Still not the same. Something like this would be, though:
#macro a(foo)
#declare Switch=foo;
#end
#macro b()
#if (Switch)
// do one thing
#else
// do another thing
#end
#end
but, perversely, I find the nested macro solution somehow more elegant.
For one thing, it uses one less entry in the global symbol table. For
another, it parses more quickly, particularly if you'll be calling b a
lot.
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
![](/i/fill.gif) |