Index: library/xotcl/doc/langRef.xotcl =================================================================== diff -u -rf3b7952aabc9e4f9079febd1f5b7f5fb833fd50c -re8715774bf274fbeadabf08a5a0777a968f71148 --- library/xotcl/doc/langRef.xotcl (.../langRef.xotcl) (revision f3b7952aabc9e4f9079febd1f5b7f5fb833fd50c) +++ library/xotcl/doc/langRef.xotcl (.../langRef.xotcl) (revision e8715774bf274fbeadabf08a5a0777a968f71148) @@ -1,5 +1,5 @@ -# $Id: langRef.xotcl,v 1.14 2006/10/04 20:40:23 neumann Exp $ -package provide XOTcl-langRef 1.6.0 +# $Id: langRef.xotcl,v 1.18 2007/09/05 19:09:22 neumann Exp $ +package provide XOTcl-langRef 1.6.4 package require XOTcl @ @File { @@ -225,12 +225,13 @@ Turn on/off assertion checking. Options argument is the list of assertions, that should be checked on the object automatically. Per default assertion checking is turned - off. Examples: - <@pre class='code'> - o check {}; <@it># turn off assertion checking on object o - o check all; <@it># turn on all assertion checks on object o - o check {pre post}; <@it># only check pre/post assertions - <@a href="#Object-info">info check introspects check options. + off.
+ Examples:
+<@pre CLASS="code"> + o check {}; <@i># turn off assertion checking on object o + o check all; <@i># turn on all assertion checks on object o + o check {pre post}; <@i># only check pre/post assertions + } return "empty string" } @@ -251,7 +252,7 @@ } { Description { Resets an object or class into an initial state, as after construction. - Called during recreation process by the method recreate. + Called during recreation process by the method 'recreate' } return "empty string" } @@ -260,18 +261,11 @@ ?args? "'-' method calls" } { Description { - Calls the '-' (dash) methods. This method evaluates its argument list - and calls everything starting with '-' (followed by an alpha character) - as a method. Every list element until the next '-' is interpreted as an - argument of the called method. XOTcl supports argument lists with a variable - number of arguments. If an argument 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") to avoid - the interpretation of "a-" as a method. -

The method configure is called automatically by - the default create and recreate methods after - the default values are set.

-

+ Calls the '-' (dash) methods. I.e. evaluates arguments and calls + everything starting with '-' (and not having a digit a + second char) as a method. Every list element until the next '-' + is interpreted as a method argument. configure is called + before the constructor init during initialization and recreation. In the following example, the variable set is called via configure before init: <@pre class='code'> Object o -set x 4 @@ -356,10 +350,10 @@ Description { Standard destructor. Can be overloaded for customized destruction process. Actual destruction - is done by dealloc. "destroy" in principal does: + is done by instdestroy. "destroy" in principal does: <@pre class='code'> Object instproc destroy args { - [my info class] dealloc [self] + [my info class] instdestroy [self] } } return "empty string" @@ -505,19 +499,7 @@ return "1 or 0" } -@ Object instproc init { - args "argument list" -} { - Description { - The method <@tt>init is called automatically by the default - <@tt>create method on initialized - objects (the default variables are set, the configure - methods are already performed). This method is solely a user hook for - applications to perform class specific initialzation after object creation. - } -} - @ Object instproc incr { varName "variable name" ?increment? "value to increment" @@ -606,9 +588,6 @@ 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 @@ -981,7 +960,7 @@ } @ Class instproc alloc { obj "new obj/class name" - ?args? "arguments passed during creation" + ?args? "arguments passed to the new class after creation" } { description { @@ -995,7 +974,7 @@ objects via <@tt>alloc<@/tt>. } - return "fully qualified name of created instance" + return "new class name" } @ Class instproc allinstances { @@ -1013,18 +992,6 @@ description { Create user-defined classes or objects. If the class is a meta-class, a class is created, otherwise an object. - The object creation protocol implemened by create works as follows: -

The method <@tt>create<@/tt> is responsible for allocating and initializing objects. The method can be overloaded e.g. in a @@ -1052,9 +1019,17 @@

+ Create firstly calls <@tt>alloc in order to allocate memory for the + new object. Then default values for parameters are searched on superclasses (an set if found). + + Finally the constructor <@tt>init is called on the object + with all arguments up to the first '-' arg.<@p> + The <@tt>create method is often called implicitly through the - method. E.g. the following two commands are equivalent + <@tt>unknown + mechanism when a class (meta-class) is called with an unknown + method. E.g. the following two commands are equivalent <@pre class='code'> Car herby -color red @@ -1068,9 +1043,8 @@ <@pre class='code'> Class Car -init -superclass Vehicle <@/pre> - See also: <@tt>recreate } - return "fully qualified name of the created instance (result of alloc)" + return "name of the created instance (result of alloc)" } @ Class instproc info { @@ -1126,7 +1100,7 @@ all instfilterguards are integrated (<@TT> ClassName info instfilter -guards). - <@li><@TT>ClassName info instfilterguard name: Returns the guards + <@li><@TT>objName info instfilterguard name: Returns the guards for instfilter identified by name. <@li><@TT>objName info instforward ?-definition name? ?pattern?: @@ -1159,9 +1133,6 @@ 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 @@ -1216,12 +1187,12 @@ return "Value of introspected option as a string." } -@ Class instproc dealloc { +@ Class instproc instdestroy { obj "obj/class name" ?args? "arguments passed to the destructor" } { Description { - Destroys XOTcl object physically from the memory. + Standard destructor. Destroys XOTcl object physically from the memory. Can be overloaded for customized destruction process. <@p> In XOTcl objects are not directly destroyed, when a destroy is @@ -1370,7 +1341,7 @@ @ Class instproc instproc { name "instance method name" - "?non-pos-args?" "optional non-positional arguments" + ?non-pos-args?" "optional non-positional arguments" args "instance method arguments" body "instance method body" "?preAssertion?" "optional assertions that must hold before the proc executes" @@ -1402,7 +1373,7 @@ If <@tt>-childof obj is specified, the new object is created as a child of the specified object. } - return "fully qualified name of the created instance" + return "new object name" } @ Class instproc parameter { @@ -1461,29 +1432,18 @@ ?args? "arbitrary arguments" } { description { - Hook called upon recreation of an object in cases where the user wants to distinguish - between creation and recreation of objects. A recreation occurs, when an Object is created - with a name that exists already. - A typical use-case is the redefinition - of classes in and IDE, where the relations between classes/classes and object/classes - should be preserved (this is different to a destroy of the object). - -

The method recreate does not need to call alloc - but calls instead cleanup - to reset to the object (or class) to its initial state (e.g. remove variables, child objects, - for classes remove instaces, etc.). Then it performs the standard initialization - for the object or class. - -

If recreate is overloaded and the default recreate method is called via next, - the pre-part - (before next) contains its old state of the object, - while during the part after next the - object is cleaned up. -

To ease recreation of classes, see ::xotcl::configure softrecreate. - - See also: <@tt>create + Methods called upon recreation of an object. Recreate is called, + when an object/class is created, but a same-named object/class + exists already. "recreate" is not called, when an object is trying + to be recreated as a class or vice versa. In these cases, + recreating is realized via destroy+create. The Methods "recreate" + performs standard object initialization, per default. May be + overloaded/-written. It calls another method cleanup which handles + actual cleanup of the object during next. That means, if you + overload recreate, in the pre-part the object still contains its + old state, after next it is cleaned up. } - return "fully qualified name of instance" + return "obj name" } @ Class instproc superclass { @@ -1594,7 +1554,7 @@

Example of a class definition with three attribute slots:

-
+<@pre CLASS="code">
   <@tt>Class Person -slots {
     Attribute name
     Attribute salary -default 0