Jump to content
  • Advertisement
Sign in to follow this  
WitchLord

AngelScript namespaces

This topic is 2515 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!