Index: doc/langRef.xotcl =================================================================== diff -u -r46f02e4868e118466d888b35d6b281b3f2ba31ac -r2111020b49da8ce57758e51accf0b6073037f0d2 --- doc/langRef.xotcl (.../langRef.xotcl) (revision 46f02e4868e118466d888b35d6b281b3f2ba31ac) +++ doc/langRef.xotcl (.../langRef.xotcl) (revision 2111020b49da8ce57758e51accf0b6073037f0d2) @@ -1,5 +1,5 @@ # $Id: langRef.xotcl,v 1.14 2006/10/04 20:40:23 neumann Exp $ -package provide XOTcl-langRef 1.5.2 +package provide XOTcl-langRef 1.6.0 package require XOTcl @ @File { @@ -113,18 +113,39 @@ with class definitions (e.g. when used in OpenACS with file watching and reloading). With <@tt>softrecreate set, it is not necessary to recreate dependent subclasses etc. -
+

Example: e.g. there is a class hierarchy A <- B <- C Without <@tt>softrecreate set, a reload of B means first a destroy of B, leading to A <- C, and instances of B are re-classed to ::xotcl::Object. When <@tt>softrecreate is set, the structure remains unchanged.

+
<@tt>::xotcl::finalize<@/tt>
+
Delete all XOTcl objects and classes and free all associated memory. +

+ This command has the only purpose to delete all objects and classes + of an interpreter in a multi-threaded environment at a safe time. +

+ Background: when XOTcl is used in a threaded environment such as + for example in AOLserver, one has to take care that the deletion + of objects and classes happens in a safe environment, where the + XOTcl destructors (destroy methods) are still able to + run. Without ::xotcl::finalize the deletion happens in + Tcl_FinalizeThread(), after thread cleanup (where e.g. the + thread local storage is freed). This can lead to memory leaks in + AOLserver, which allocates e.g. some structures on demand, but + since this happens after cleanup, it will leak. A simple ns_log + in a destructor might lead to this problem. The solution is to + call ::xotcl::finalize in the "delete trace" in AOLserver (as it + happens in OpenACS). +

+ Note, that ::xotcl::finalize is not intended for application programs. +

+ } - date { $Date: 2006/10/04 20:40:23 $ } } ## @@ -257,7 +278,14 @@ The method configure can be called with the dash-notation at arbitrary times: <@pre class='code'> o configure -set x 4 - } + + Note, that if '-' is followed by a numerical, the arument is + interpreted as a negative number (and not as a method). If a + value of a method called this way starts with a "-", the call can + be placed safely into a list (e.g. "Class c [list -strangearg -a-] + -simplearg 2"). +

See also create. + } return "number of the skipped first arguments" } @@ -515,10 +543,8 @@ <@li><@TT>objName info body method: Returns the body of the specified proc (object specific method). - <@li><@TT>objName info class ?classname?: - Returns the name of the class of the current object, if className was - not specified, otherwise it returns 1 if className matches the - object's class and 0 if not. + <@li><@TT>objName info class: + Returns the name of the class of the current object. <@li><@TT>objName info children ?pattern?: Returns the list of aggregated objects with fully qualified names if @@ -543,10 +569,14 @@ <@li><@TT>objName info filterguard name: Returns the guards for filter identified by name. - <@li><@TT>objName info forward ?-definition? name: Checks, - whether <@TT>name<@/TT> is a forwarder (accepts wild chard characters). - When <@TT>-definition is specified, it returns the definition - of the forwarder. + <@li><@TT>objName info forward ?-definition name? ?pattern?: + Returns the list of forwarders. One can call this method either + without the optional arguments, or with the <@TT>pattern + or with <@TT>-definition name. When the <@TT>pattern is specified + only the matching forwarders are returned. When the <@TT>definition + option is used together with a name of a forwarder, the definition + of the forwarder with all flags is returned in a way that + can be used e.g. for registering the forwarder on another object. <@li><@TT>objName info hasNamespace: From XOTcl version 0.9 on, namespaces @@ -567,16 +597,26 @@ <@TT>-nocmds only returns procs. Modifier <@TT>-nomixins excludes search on mixins. - <@li><@TT>objName info mixin: Returns the list of mixins - of the object. With <@TT>-order modifier the order of mixins - (whole hierarchy) is printed. + <@li><@TT>objName info mixin ?-order? ?-guard? ?pattern?: + Returns the list of mixins of the object. With <@TT>-order + modifier the order of mixins (whole hierarchy) is printed. If + <@TT>-guard is specified, the mixin guards are returned. + If <@TT>pattern is specified and it contains wildcards, + all matching mixins are returned. If <@TT>pattern does not + contain wildcards, either the fully qualified name is returned, + or empty, if no match exists. <@li><@TT>objName info mixinguard name: Returns the guards for the mixin identified by name. <@li><@TT>objName info nonposargs methodName: Returns non-positional arg list of methodName + <@li><@TT>objName info parametercmd ?pattern?: + Returns a list of registered parametercmds the object + (or empty if there are none). If <@TT>pattern + is specified, only the matching parametercmds are returned. + <@li><@TT>objName info parent: Returns parent object name (or "::" for no parent), in fully qualified form. @@ -591,9 +631,11 @@ defined for the object if <@TT>pattern was not specified, otherwise it returns all procs that match the pattern. - <@li><@TT>objName info precedence ?pattern?: Returns all + <@li><@TT>objName info precedence ?-intrinsic? ?pattern?: Returns all classes in the precedence order from which the specified - object inherits methods. The returned list of classes contains + object inherits methods. If the flag <@TT>-intrinsic is specified + only the intrinsic classes (from the class hierarchy) are specified. + If the flag is not specified, the returned list of classes contains the mixin and instmixin classes as well as the classes of the superclass chain in linearized order (i.e., duplicate classes are removed). If the pattern is specified, only matching classes @@ -942,13 +984,16 @@ ?args? "arguments passed during creation" } { description { - Allocate (create) an uninitialized object or class. Typically, alloc - is called automatically by <@tt>create<@/tt> - to allocate an uninitialized object or class. - In contrast to alloc, <@tt>create<@/tt> also - initializes and configures the object. - The method alloc can be used by a programmer who may want to - create uninitialized objects/classes. + + Allocate an uninitialized XOTcl object or class. Alloc is used by + the method <@tt>create<@/tt> to + allocate the object. Note that <@tt>create<@/tt> also calls as + well configure and init to initialized the + object. Only in seldom cases the programmer may want to suppress + the <@tt>create<@/tt> mechanism and just allocate uninitiaized + objects via <@tt>alloc<@/tt>. + } return "fully qualified name of created instance" } @@ -981,10 +1026,34 @@ with all arguments up to the first '-' argument (as returned by configure). -

In the default XOTcl definition, the <@tt>create method - is called implicitly by the <@tt>unknown method of the metaclass - Class, when a class (meta-class) is called with an unknown + The method <@tt>create<@/tt> is responsible for allocating and + initializing objects. The method can be overloaded e.g. in a + metaclass if other initialization behavior is wanted. +

+ The standard behavior of <@tt>create<@/tt> is as follows: +

    + +
  1. Call the method <@tt>alloc<@/tt> to + create an uninitialized object. + +
  2. Call the method <@tt>searchDefaults<@/tt> to set default + values for instance attributes- + +
  3. Call the method <@tt>configure<@/tt> to + configure the object with the values provided at object creation + time. The method <@tt>configure<@/tt> interprets the arguments + with leading dashes as method calls. + +
  4. Call the method <@tt>init<@/tt> to + allow initialization by the class. The argument passed to init are the + values from the passed argument list containing the arguments up to the first '-'.<@p> + +
+

+ superclasses (an set if found). + The <@tt>create method is often called implicitly through the method. E.g. the following two commands are equivalent <@pre class='code'> @@ -1028,9 +1097,14 @@ of the class hierarchy. If pattern is specified, only matching values are returned. - <@li><@TT>ClassName info instances ?pattern?: - Returns a list of the instances of the class. - If pattern is specified, only matching values are returned. + <@li><@TT>ClassName info instances ?-closure? ?pattern?: + Returns a list of the instances of the class. If + <@TT>-closure is specified, the resultet contains as well + the instances of subclasses. If <@TT>pattern is specified + and it contains wildcards, all matching instances are + returned. If <@TT>pattern does not contain wildcards, + either the fully qualified name is returned, or empty, if no + match exists. <@li><@TT>ClassName info instargs method: Returns the arguments of the specified instproc (instance method). @@ -1055,23 +1129,47 @@ <@li><@TT>ClassName info instfilterguard name: Returns the guards for instfilter identified by name. - <@li><@TT>ClassName info instforward ?-definition? name: Checks, - whether <@TT>name<@/TT> is a forwarder (accepts wild chard characters). - When <@TT>-definition is specified, it returns the definition - of the forwarder. + <@li><@TT>objName info instforward ?-definition name? ?pattern?: + Returns the list of instforwarders. One can call this method either + without the optional arguments, or with the <@TT>pattern + or with <@TT>-definition name. When the <@TT>pattern is specified + only the matching instforwarders are returned. When the <@TT>definition + option is used together with a name of a isntforwarder, the definition + of the instforwarder with all flags is returned in a way that + can be used e.g. for registering the instforwarder on another class. <@li><@TT>ClassName info instinvar: Returns class invariants. - <@li><@TT>ClassName info instmixin: - Returns the list of instmixins of this class. + <@li><@TT>ClassName info instmixin ?pattern?: Returns the + list of instmixins of this class. If <@TT>pattern is + specified and it contains wildcards, all matching mixin classes are + returned. If <@TT>pattern does not contain wildcards, + either the fully qualified name is returned, or empty, if no + match exists. + <@li><@TT>ClassName info instmixinof ?-closure? ?pattern?: + Returns the list of classes, into which this class was mixed in + via instmixin. This is the inverse function of <@TT>ClassName + info instmixin. If <@TT>-closure is specified, also + the classes are returned, for which the class is indirectly + mixed in via instmixin. If <@TT>pattern is specified and + it contains wildcards, all matching mixin classes are + returned. If <@TT>pattern does not contain wildcards, + either the fully qualified name is returned, or empty, if no + match exists. + <@li><@TT>ClassName info isntmixinguard name: Returns the guards for the instmixin identified by name. <@li><@TT>ClassName info instnonposargs methodName: returns list of non-positional args of methodName + <@li><@TT>objName info instparametercmd ?pattern?: + Returns a list of registered instparametercmds the class + (or empty if there are none). If <@TT>pattern + is specified, only the matching instparametercmds are returned. + <@li><@TT>ClassName info instpost methodName: Returns post assertions of methodName. @@ -1082,22 +1180,37 @@ Returns all instprocs defined for the class. If pattern is specified it returns all instprocs that match the pattern. + <@li><@TT>ClassName info mixinof ?-closure? ?pattern?: Returns the + list of classes, into which this class was mixed in via per + object mixin. This is the inverse function of <@TT>Object info + mixin. If <@TT>-closure is specified, also the + classes are returned, for which the class is indirectly mixed in + as a per-object mixin. If <@TT>pattern is specified and + it contains wildcards, all matching mixin classes are + returned. If <@TT>pattern does not contain wildcards, + either the fully qualified name is returned, or empty, if no + match exists. + <@li><@TT>ClassName info parameter: Returns parameter list. - <@li><@TT>ClassName info subclass ?subclassname?: - Returns a list of all subclasses of the class, if subclassname - was not specified, otherwise it returns 1 if subclassname is a - subclass and 0 if not. + <@li><@TT>ClassName info subclass ?-closure? ?pattern?: + Returns a list of all subclasses of the class. If + <@TT>-closure is specified, the result contains as well + the subclasses of the subclasses. If <@TT>pattern is + specified and it contains wildcards, all matching subclasses are + returned. If <@TT>pattern does not contain wildcards, + either the fully qualified name is returned, or empty, if no + match exists. - <@li><@TT> ClassName info superclass ?superclassname?: - Returns a list of all super-classes of the class, - if superclassname was not specified, otherwise it returns - 1 if superclassname is a superclass and 0 if not. - - <@li><@TT>ClassName info slots: - Returns the slot objects defined for this class. - + <@li><@TT> ClassName info superclass ?-closure? ?superclassname?: + Returns a list of all super-classes of the class. If + <@TT>-closure is specified, the result contains as well + the superclasses of the superclasses. If <@TT>pattern is + specified and it contains wildcards, all matching superclasses are + returned. If <@TT>pattern does not contain wildcards, + either the fully qualified name is returned, or empty, if no + match exists. <@/ul> } return "Value of introspected option as a string."