POV-Ray : Newsgroups : povray.unofficial.patches : MegaPOV quirks and questions.. : Re: MegaPOV quirks and questions.. Server Time
2 Sep 2024 00:18:07 EDT (-0400)
  Re: MegaPOV quirks and questions..  
From: Alex Vandiver
Date: 25 Jul 2000 00:07:17
Message: <397D11B1.18DE50F5@tiac.net>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.