• Advertisement
Sign in to follow this  

Pointers in AngelScript: Really necessary?

This topic is 4831 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

Advertisement
Thanks everyone for giving your opinions. I've made my decisions:

1. AngelScript 1.10.0 will be released with full support for arrays and still keep pointers around.

2. After that I will start working on AngelScript 2.0.0 that will take lot of inspiration from Java and get rid of pointers and make all objects be passed around by references. This will make the treatment of objects more uniform, which will make it much easier for me to introduce script declared classes and context state serialization, etc.

3. Further development of features will go under the 2.x.x versions, but I will keep supporting version 1.x.x with bug fixes and perhaps a few minor changes to make it easier to use (mainly an improved interface for calling script functions).

It's not possible to please everyone, but I try to do my best. I'm pleased to know that the majority agree with my decision. I know that Abrken may be a bit sad to see the pointers go, but I hope that he will in the future move over to AngelScript 2.x.x as well.

I didn't see any word from EddHead (Raptor Entertainment) but he is still using version 1.7.1 so I'm sure whatever I decide the work to upgrade would be quite big anyway.

Once more: Thanks everyone.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I've been following AngelScript for awhile now, and have been taking some Java classes recently. While I hate Java as a language, I think it would be awesome to see the way they handle Objects in AngelScript. And anything that can speed up the library is always a plus.

Share this post


Link to post
Share on other sites
Would it be possible to integrate smart pointers into this? It would remove the need to have raw pointers, what I'd like to have is the possibillity to just use it like Class->Method when Class is actually a smart pointer.
I am not sure if this would still allow you to simplify AS as a whole, but if it was, this would be nice. Shouldn't be too hard either, basically there'd just need to be some way to register a function for the script engine that would allow it to retrieve the actual class on which it would then execute the method.

Share this post


Link to post
Share on other sites
Quote:
Original post by Wuntvor
Would it be possible to integrate smart pointers into this? It would remove the need to have raw pointers, what I'd like to have is the possibillity to just use it like Class->Method when Class is actually a smart pointer.


Personally, I think if you're going to remove pointers from the script, you should also remove the operator->. This would simplify the the syntax of the language, as it can only be used with pointers (since I belive AS doen't allow you to overload operator-> in your classes.)

Just my thoughts on the matter though.

Share this post


Link to post
Share on other sites
Mortal:

AngelScript 2 will work with object basically the same way as Java does. There will be a slight performance hit because of this, but it should be negligable in the context of a scripting language. The language syntax will be simpler though, and much more consistent. And of course it will be easier for me to develop further features.

Wuntvor:

AngelScript 2's object variables will basically be smart pointers. The . operator will access the objects methods directly. I'm not sure if the -> will be implemented, probably not.

I may implement the possibility to overload -> for AngelScript 1.x.x though. That should allow you to implement smart pointers.

desertcube:

I agree.

Share this post


Link to post
Share on other sites
I'm using handle classes exstensivly. Though I don't technically need an operator->, it would simplify a lot of things in my scripts. The handles manage pointers. They are essentially reference counted smart pointers that make calls directly into the engine to manage game resources. Right now, I pass them to global functions. It is, unfortunatly, quite possible to pass a texture to a function that expects a sound. With operator->, I could register the texture class, and all the functions that use it as methods, and continue using my handles - except with type safety! (Assuming, of course, polymorphism works in some future release.)

Share this post


Link to post
Share on other sites
I would also like the -> operator to remain, but only as an overloaded operator. I don't really need it, but it provides a nicer syntax.

Share this post


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

  • Advertisement