|
 |
Cousin Ricky <ric### [at] yahoo com> wrote:
> One just has to keep in mind POV-Ray's scope leakage
> problems[2] when choosing names:
>
> - Once a macro is defined, its name cannot be reused as a global or
> local identifier--though it can be reused as a macro formal
> parameter.
> - Once a function is defined, its name cannot be reused as a global
> or local identifier--though it can be reused as a macro formal
> parameter.
> - Once *any* identifier is declared, it cannot be reused as a macro
> name.
> - Once *any* identifier is declared, it cannot be reused as a
> function name.
> - Once *any* identifier is declared, it cannot be reused as a
> function formal parameter. (If you were unlucky, math.inc 3.5
> would bomb out for this very reason. Precautions were taken
> starting with math.inc 3.6; for an example, you can take a look
> at function adj_range2().)
These things are good to know.
Scope can get pretty tricky and anxiety-inducing when I'm using things like
nested loops inside of macros, etc.
I'm never really sure when my identifier is valid/retains its value and when it
gets "released".
One day, when i get other things out of my hair, I'll probably try to write an
example scene that does all sorts of identifier backflips and other other
calisthenics.
> [1] I hadn't yet discovered f_sqr() and sgn() from math.inc,
I'm not sure why things like sgn() aren't in the source code. It drives me
crazy when certain things I'd consider central to the operation of a lot of code
aren't written in the source code, and need to rely on include files...
And we don't really have very many proper matrix handling macros - which I kind
of found surprising for a 3D graphics package.
Thanks for you summary of the scope issues - these should make their way into
the official documentation.
Post a reply to this message
|
 |