| add_var() | clear_var() | default_var() | del_var() |
| get_var() | inherited_var() | set_var() | variables() |
add_var()
INTEGER add_var(SYMBOL name)
This function defines the object variable name on the current object. If an object variable already exists by that name, the error ~varexists is thrown. A value of 1 (one) is returned upon successful execution of this function.
clear_var()
INTEGER clear_var(SYMBOL name)
This function clears the instance of an object variable on a descendant. The variable specified by name must be defined on the same ancestor defining the method which is calling clear_var(). If not, the error ~varnf is thrown. If this function is not called before an ancestor is removed, variables defined on that ancestor and set on the current object will remain (due to encapsulation). This function is also useful in reducing database usage, as a cleared variable takes up no space, where a set variable does. A value of 1 (one) is returned upon successful execution of this function.
See ColdC Objects: Variables for more information on the instance of an object variable.
default_var()
ANY default_var(SYMBOL name)
This function returns the defining object's instance of the object variable specified by name. Any method calling this function must be defined on the same object on which the variable is defined. If the object variable is not defined, the error ~varnf is thrown. Otherwise the value of the defining object's instance of the variable is returned.
del_var()
INTEGER del_var(SYMBOL name)
This function deletes the object variable specified by the argument name. This function must be called on the object on which the variable is defined (it does not delete an instances of inherited variables). If the object variable is not defined on the current object, the error ~varnf is thrown. A value of 1 (one) is returned upon successful execution of this function.
get_var()
ANY get_var(SYMBOL name)
This function returns the current object's instance of the object variable specified by the argument name. The variable must be defined on the same object which defined the method which calls get_var(). If the object variable is not defined, the error ~varnf is thrown. Otherwise the current object's value for the variable is returned.
This function should generally only used when there is confusion with a local variable. Otherwise, object methods should be used to access object variables. For more information see Variable Expressions.
inherited_var()
ANY inherited_var(SYMBOL name)
This function returns the instance of the object variable specified by name as it is defined on the object from which it is inherited. If this variable is inherited directly from the object on which it is defined, then this function will return the same value as default_var(). Any method calling this function must be defined on the same object on which the variable is defined. If the object variable is not defined, the error ~varnf is thrown. Otherwise the value of the inherited object's instance of the variable is returned.
set_var()
ANY set_var(SYMBOL name, ANY value)
This function sets the instance of an object variable on the current object. The variable must be defined on the same object which defined the method which calls set_var(). If the object variable is not defined, the error ~varnf is thrown. The return value for set_var() is the second argument value. Using this function is the same as using the assignment operator. The following two examples are equivalent:
set_var('time_stamp, time());
time_stamp = time();
This function should generally be used only when there is confusion with a local variable. Otherwise, object methods should be used to access object variables. For more information see Variable Expressions.
variables()
LIST variables()
This function is used to determine all of the object variables defined on the current object (not the instances of all variables). A list of symbols naming each variable is returned.