POV-Ray : Newsgroups : povray.general : #local access : Re: #local access Server Time
8 Aug 2024 10:23:43 EDT (-0400)
  Re: #local access  
From: Chris Huff
Date: 3 Mar 2001 13:03:03
Message: <chrishuff-FD9DEC.13003803032001@news.povray.org>
In article <slr### [at] fwicom>, ron### [at] povrayorg 
wrote:

> #declare foo=0;
> #while (foo < 100)
>   #declare bar=Something(foo);
>   DoSomething(foo,bar);
>   #declare foo=foo+1;
> #end
> 
> This would become a parse error in your version, because #declare would
> find a defined identifier on the LHS the second time through the loop.
> Making working scenes break is not generally considered A Good Thing.

It doesn't...the #set patch doesn't and won't interfere with #declare 
being used to modify variables created with #declare. The variable "bar" 
would be a global variable created by the first loop and modified by 
later loops. You *could* do:
#ifndef(foo)
    #declare foo = Something(foo);
#else
    #set foo = Something();
#end

But this would act the same as simply:
#declare foo = Something(foo);

My objection is simply to #declare modifying variables created by #local.
Maybe a new #global keyword would be the best choice...
#global Foo = bar;
would create a global variable named Foo or modify an existing global 
variable with that name, and
#local Foo = Foo + global(Foo);
would add a local Foo to the global Foo. (assigning the result to the 
local version, of course)

#declare would act the way it does now...or at least the way it is 
documented to act.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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