Hello, I have a few questions about constness in AS. I do like const both in C++ and AS because it helps with maintainability, but I was wondering how it could change performance for some cases I couldn't find on the wiki:
- Can registering methods as const methods when relevant ever help with script performance or could help crafting faster scripts?
- Can defining primitives or objects as const help with performance?
I also have a question for something I'm not sure about: With AS 2.27.1 (which we are upgrading when we get the weirdness on our VS2010 builds sorted out), I can't seem to do something like:
const SColor white(255, 255, 255, 255);
switch(0xFFFFFFFF)
{
case white.color: print('ok');
};
I do get this error:
Script: Case expressions must be constants
Is this a bug or is this expected? Of course, our usecase is not as dumb as this example..
Thanks for your work on AS