POV-Ray : Newsgroups : povray.general : Warn About Naming Conflicts? : Re: Warn About Naming Conflicts? Server Time
31 Jul 2024 16:23:46 EDT (-0400)
  Re: Warn About Naming Conflicts?  
From: Ben Chambers
Date: 6 Dec 2006 05:05:26
Message: <457695e6$1@news.povray.org>
Warp wrote:
> #declare Index = 0;
> #while(Index < 10000)
>   #declare TheObject = sphere { <Index, 0, 0>, 1 pigment { rgb 1 } };
>   ... (do something with TheObject) ...
>   #declare Index = Index+1;
> #end
> 
>   How many warnings do you get?
> 

#local index = 0;
#while (index < 10000)
   #local TheObject = sphere { <index, 0, 0>, 1 pigment {rgb 1} };
   ... (do something with TheObject) ...
   #local index = index+1;
#end

No warnings at all :)
That's why I said it would take some work to get a lot of the current 
include files to work with this; of course, the behavior could be 
switched off via a command-line option (or an ini file option).

Basically, you would only use #declare for items that truly need to be 
global in scope, rather than using it out of habit.  Of course, I also 
like the idea I put forward of container objects, but this seemed like 
an easier solution to implement.

...Chambers


Post a reply to this message

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