AngelScript namespaces

Started by
2 comments, last by _Vicious_ 12 years, 2 months ago
I just finished the initial implementation of namespaces in AngelScript. It is already working well, but I'm quite sure there are a lot of things that I missed. I do not want to hold off on releasing version 2.22.2 until I can try to think of and implement all possible tests needed to make sure namespaces work in all concerns.

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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Is it possible to register an application workspace? If so, how?
It's not yet possible to register the application interface in specific namespaces. I'll implement that in version 2.23.0 as it requires updates to the API.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Well, I guess I'll have to wait till version 2.23.0 arrives :)

This topic is closed to new replies.

Advertisement