So, I'm asking for a little help in validating the new functionality. Those that have plans to use namespaces in your projects should definitely try the latest version from the SVN (currently at revision 1130) and try to use them as you had intended.
Those that do not plan to use namespaces may also want to give it a try anyway, just to make sure nothing got broken in the implementation, though my regression tests say that everything else is working just fine without any negative impact.
Namespaces in AngelScript work pretty much as in C++, except I haven't implemented the 'using namespace' feature yet, so when referring to symbols from other namespaces it is necessary to explicitly write out the namespace.
Nested namespaces work as well, but currently a child namespace doesn't automatically see the symbols in the parent namespace, so here too is it necessary to explicitly inform the parent namespace.
namespace A
{
int a = 0;
void function() { a++; } // referring to symbols in the same namespace doesn't require scoping
}
void main()
{
A::function(); // referring to symbols from other namespaces require explicit scoping
}
For future releases I'll continue to work improving the namespaces with 'using namespace' feature, and implicitly seeing parent namespaces, etc. Namespaces also provide a stepping stone for adding support for static members in classes as well as declaration of enums and subclasses as children of classes.
However the real reason I wanted to implement namespaces is that I plan on allowing the application to define access masks on them, thus allowing the application to control which modules may or may not use specific namespaces. This will make it possible share both code and global variables in a controlled manner between modules.
Regards,
Andreas