todl reference guide (draft version) ====================================================================== Constructor and destructor. For each class, a ctor and dtor proc are generated. - The ctor name is the name of the class. If you specify the module parameter 'new_name', that name is prefixed before the class name. - The ctor creates the global array '_array' and stores the instance's attributes in it. - The ctor also fills a singleton global array 'odl_types_array' with the types of the instances. - Then, the ctor sets up a proc with the instance's name to act as an object command (see the "object command" idiom; One well-known use is Tk widgets that act like objects). This object command recognizes the methods declared in the odl schema, plus 'configure' and 'cget' that act as in Tk, to set and get the values of the attributes defined in the odl schema. - The ctor calls all ctors of contained objects - Then, the ctor calls the 'init' method of the object (unless you set 'init_name' to "-" in the schema). - Finally, the ctor uses the rest of its arguments to initialize the object's attributes. - The dtor name is what you specify in the module parameter 'delete_name'. If you set this to "-", no dtor is generated (and you'll get memory leaks for sure). - The dtor first calls the 'exit' method unless 'exit_name' is "-". - The dtor then calls the dtors of contained objects, if any. - Finally, the resources of the deleted object are freed, and the object command is destroyed. Its name disappears from the global namespace. ------- Other generated procs. For each class, a member proc is generated that creates local variables for the instance's attributes. Set the 'member_name' module parameter to "-" if you do not want this to be generated. If you prefer a single global proc rather than one per module, look in 'odl_glb.tcl'. If the module parameter 'init_name' has a value, each class gets an initialization proc, which is called from the ctor (as explained above). If the module parameter 'exit_name' has a value, each class gets an "exitialization" proc, which is called from the dtor (as explained above). If the module parameter 'get_name' has a value, each class gets a proc that is invoked when an attribute is fetched using 'cget'. The proc arguments are an object handle and the name of the attribute (without the leading dash). You must implement this proc for all classes in the module, unless you do not give a value to 'get_name'. If the module parameter 'set_name' has a value, each class gets a proc that is invoked when an attribute is changed using 'configure'. The proc arguments are an object handle, the name of the attribute (without the leading dash), the old value of the attribute, and the new value. The proc is called *after* the attribute has already been changed. You must implement this proc for all classes in the module, unless you do not give a value to 'set_name'.