Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

AngelScript namespaces


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Andreas Jonsson   Moderators   -  Reputation: 3267

Like
0Likes
Like

Posted 25 January 2012 - 02:49 PM

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

Sponsor:

#2 _Vicious_   Members   -  Reputation: 240

Like
0Likes
Like

Posted 25 January 2012 - 03:30 PM

Is it possible to register an application workspace? If so, how?

#3 Andreas Jonsson   Moderators   -  Reputation: 3267

Like
0Likes
Like

Posted 26 January 2012 - 04:23 PM

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

#4 _Vicious_   Members   -  Reputation: 240

Like
0Likes
Like

Posted 28 January 2012 - 03:12 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS