POV-Ray : Newsgroups : povray.general : POV-Ray Includes - Standards : Re: POV-Ray Includes - Standards Server Time
1 Aug 2024 00:19:32 EDT (-0400)
  Re: POV-Ray Includes - Standards  
From: John VanSickle
Date: 1 Dec 2006 21:21:06
Message: <4570e312@news.povray.org>
Ben Chambers wrote:

> John VanSickle wrote:
> 
>> Namespaces are probably the best way.  Ideas:
>>
>> * #namespace LABEL creates the namespace LABEL if it doesn't already 
>> exist.  Whether new or not, namespace LABEL becomes the active 
>> namespace (the former namespace is saved on a stack).

By this stack thing I mean that the fact of being active is kept saved 
on a stack.

>> * #namespace undef pops the current namespace off of the stack, and 
>> the former namespace becomes active.
> 
> Rather than that, why not just utilize
> #namespace
> with no arguments, to return to the global namespace?

But there file or macro may return to code that had a different 
namespace active; returning to the global may mess that up.

To go to the global, there should probably be a keyword for it so that 
the scene coder gets a chance to know what he's doing.

>> * All #declare and #local statements affect the variable in the 
>> current namespace.  Other variables of the same name in other 
>> namespaces are not affected.
>>
>> * #declared variables live from one invocation of the namespace to the 
>> next, but #labeled variables die when the namespace passes out of 
>> scope (end of macro, end of file, popped by #namepsace undef statement).
> 
> You mean #local items, right?

Yeah, I meant #localed instead of #labeled.

> I think namespaces are the perfect way to go, especially as the 
> community using POV-Ray matures in their code-writing efforts.

I was trying to come up with something that is easy for the SDL user to 
understand (which means something far less complex that C++ namespaces), 
and which seems to be relatively simple to implement.

Regards,
John


Post a reply to this message

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