POV-Ray : Newsgroups : povray.general : Scope of identifiers in nested Macros : Re: Scope of identifiers in nested Macros Server Time
3 Aug 2024 22:17:41 EDT (-0400)
  Re: Scope of identifiers in nested Macros  
From: Christopher James Huff
Date: 3 Jan 2004 10:35:58
Message: <cjameshuff-D324DF.10355703012004@netplex.aussie.org>
In article <Xns### [at] netplexaussieorg>,
 ingo <ing### [at] tagpovrayorg> wrote:

> >>     #J = J + 1;
> > I like this syntax for manipulating already declared variables.
> 
> Why not throw the # away completely?
> 
> J = 0;
> J = J + 1;
> 
> Everything is local, unless it is declared global,
> 
> #global J = "global"

Ew. There's no way of telling a declaration apart from an assignment, 
unless it's global. You just completely broke the main benefits of my 
suggested method. Look at this code:

J = 0;
#while(J < 10)
    j = J + 1;
#end

That's an infinite loop. This isn't, it's an error:
#def J = 0;
#while(J < 10)
    #j = J + 1;
#end

This would also be harder to parse, and would break consistency with the 
rest of the language. I'd actually prefer something like this:

def J = 0;
while(J < 10) {
    J = J + 1;
}

or at least:

def J = 0;
while(J < 10)
    J = J + 1;
end

But you'd have to redesign the language and completely redo the parser. 
What I suggested only requires 3 small additions.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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