🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
AS 2.0 : RegisterGlobalProperty error : Why only const primitivetypes ?
I used to declare a global property
ioScriptEngine->RegisterGlobalProperty("const Texture NO_TEXTURE", &ASNoTexture);
In AS 2.0 it craps out saying "Only primitives may be declared as const".
Why is this ?
I really wouldn't want anyone to do something like NO_TEXTURE = MyCheckerboardTexture - and screwing up the default :)
The problem was that the script language wasn't able to guarantee that a const object really was constant. Object methods, or overloaded operators could still alter the object. Because of that I decided to remove the const modifier for objects until I can implement a way that guarantees object constness (does that word exist?).
The way to implement it would be with adding the const modifier for object methods as well, e.g. CLASS::Method() const. The library could then disallow calls to non-const methods for constant objects.
I want to add const for objects again, but it's not very high on my priority list. Maybe I need to increase this priority again.
The way to implement it would be with adding the const modifier for object methods as well, e.g. CLASS::Method() const. The library could then disallow calls to non-const methods for constant objects.
I want to add const for objects again, but it's not very high on my priority list. Maybe I need to increase this priority again.
Quote: Original post by WitchLord
I want to add const for objects again, but it's not very high on my priority list. Maybe I need to increase this priority again.
Please do, I really don't trust scripters not to change my globals :)
(And if they do they f**k up the behaviour entire program afterwards ;))
I think I have a pretty easy solution to this. If I'm right I will be able to add constant objects already for 2.1.0.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement