POV-Ray : Newsgroups : povray.binaries.images : Sky simulation : Re: Sky simulation: what is wrong with this particular code? Server Time
30 Jul 2024 10:13:42 EDT (-0400)
  Re: Sky simulation: what is wrong with this particular code?  
From: Cousin Ricky
Date: 10 Jul 2013 10:45:00
Message: <web.51dd73032dc5ff1278641e0c0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> While we're at it this also causes an error (even if the definition for
> A is in a different file):
>
> #macro A()
> #end
> #macro B()
> #local A=1;
> #end
> B()
>
> This one is a bit more serious as it means if any macro in your scene
> uses a local variable with the same name as another macro you'll get an
> error.

This is a known problem, although I do not know that the POV Team perceives it
as a problem.  When I brought it up 5 years ago, I was quoted documentation of
macro names being global in scope, which was just a red herring.  This behavior
breaks the very concept of local variables and makes "black box" modularization
impossible.

You also get an error if you declare a function with an argument that has the
same name as a previously declared variable.

I hope that these (and ALL other cases of scope leakage in POV-Ray) will be
eliminated by version 4.0.


Post a reply to this message

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