|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |