![]() |
Variable Handling Revision
Variables in Graal are handled weirdly and I would like a server option available to change them into a form I think is better.
For the first thing, when you're trying to reference a variable without a prefix, I think there should be 4 places it looks. #1. temp. variables #2. this. static variables #3. this. dynamic variables #4. global variables It would be returning the first one it finds. Also when you're declaring variables without a prefix, I believe it should look for an existing variable in that same order, and if it can't find one, it should default to temp. not a global variable. Of course that leaves the question, how are you going to declare global variables if the no-prefix defaults to temp.? Well in the function profiler and certain unusual scripting error messages, I noticed the prefix universe. I believe that prefix would be a good choice for declaring new global variables. Of course they could still be referenced without the universe. prefix if there are no temp. or this. variables of the same name. Also note that dynamic variables are case-sensitive when static variables aren't, from my limited observations that is. Edit: Would also be nice if there was some way to list the global dynamic variables. (Object names and things) Do I know if I'm overwriting something or not by using a global reference. |
second this. ;]
|
Then every script would have to be changed. You could somewhat avoid this by making it so the use of new skips the "temp." stage but it still could mess a ton of scripts up that declare global variables.
|
Quote:
Quote:
I know that it could mess things up so thats why it would be a server option (requireng an npcserver restart on change) to people can switch to that format if they wish. If such an option deals with the compiler then I suppose it wouldn't require a restart to set it, the compiler would just need to check the option on each compile. |
I totally second this
|
Quote:
|
I doubt he will be able to add this soon though since he is very busy with other updates for the client (like the playerlist lag bug).
|
We have a lot of issues like this: This or That would be better, but require completely rewriting the language...and thus completely rewriting every script on every server...I say do it, but release a Converter. A couple years after the release of Serverside we figured out there was a potential algorythm to convert it all...but Classic was already dead...really, priorities ought to go the other way around...
|
|
It could be interesting to add options to change the variable lookup, it wouldn't need to restart the server, but it would also need something to tell the client to change the variable lookup as well, at least for the local scripts. A disadvantage could be that scripts wouldn't be compatible between servers and it would be confusing if people post script examples which have different variable lookup. May be there should be a script line //#VARIABLEPREFIX2 or so at the start of the script.
|
It would also be awesome if you implemented private variables.... atleast for the serverside portion.
|
Quote:
|
Bump?
|
Quote:
|
Quote:
|
Quote:
|
I doubt anything short of bug-fixes will be in the next version.
|
| All times are GMT +2. The time now is 06:10 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.