|
|
Nathan Kopp wrote:
> Nested macro definitions are not necessary (and really should be avoided).
Except where "dynamic" macros are used. Take the following snippet:
#macro a(foo)
#if (foo)
#macro b()
// do one thing
#end // macro b, first possibility
#else
#macro b()
// do something else
#end // macro b, second possibility
#end // if statement
#end // macro a
..which unfortunatly can't be unrolled in the way you describe. The above
method has the useful effect, because of the dynamic scoping rules you mention,
of making macro b() defined after macro a() ends, and available to the rest of
the program -- but with differing effects based on the value of foo! Things
like the spline include use this to dynamically declare what a "segment" of the
spline is made of, so that the later call which actually creates the spilne is
oblivious to the type of spline it is creating.
-Alex V.
Post a reply to this message
|
|