Quote:
Originally Posted by Stefan
Hmmm In some languages there is a way to "freeze" an object. The variables of the frozen object cannot be edited anymore. That could eventually be added to Graal to make stuff like the DB-npcs not-modifiable. Eventually we could also make it so that you can "freeze" the object but still allow modifications from within the object itself.
A major problem for private variables is more the speed though, because it will need to check for each operation if the operation is allowed from the current object. Languages like C++ and Java only do private/protected stuff by the compiler, it's still possible to access those variables from outside with some tricks at runtime. So the scripting engine would need to remember the access rights for each object and check for access rights when the variable is read or modified.
A "freezing" mechanism could make that faster because it would only set the access flag for all sub-variables at the time you freeze the object, and later just check for the access flag. It could also automatically block all attempts of calling join which could be used to extend the script of an object and then send a trigger to it to modify its own variables.
|
Whatever works best so long as objects can't read/write to frozen variables
Would this be a next Gserver update?
