Index: xotcl/doc/langRef.xotcl =================================================================== diff -u -r20e421dc641dc39b53106b1296ac7e09d0b206f2 -r99a7a21854051cd691029b15ef8877aa9e86cf44 --- xotcl/doc/langRef.xotcl (.../langRef.xotcl) (revision 20e421dc641dc39b53106b1296ac7e09d0b206f2) +++ xotcl/doc/langRef.xotcl (.../langRef.xotcl) (revision 99a7a21854051cd691029b15ef8877aa9e86cf44) @@ -1,4 +1,4 @@ -# $Id: langRef.xotcl,v 1.14 2006/10/04 20:40:23 neumann Exp $ +# $Id: langRef.xotcl,v 1.15 2007/08/06 11:35:56 neumann Exp $ package provide XOTcl-langRef 1.5.2 package require XOTcl @@ -124,7 +124,7 @@ } - date { $Date: 2006/10/04 20:40:23 $ } + date { $Date: 2007/08/06 11:35:56 $ } } ## @@ -230,7 +230,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" } @@ -239,18 +239,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 [-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/tt> is called + before the constructor 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 @@ -477,19 +470,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" @@ -931,18 +912,18 @@ } @ Class instproc alloc { obj "new obj/class name" - ?args? "arguments passed during creation" + ?args? "arguments passed to the new class after 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 memory for a new XOTcl object or class. <@tt>create<@/tt> uses + <@tt>alloc to allocate memory. But <@tt>create<@/tt> also + calls init and evaluates '-' arguments as method calls. + In seldom cases the programmer may want to suppress the + <@tt>create<@/tt> + mechanism and just allocate memory. Then <@tt>alloc can + be used. } - return "fully qualified name of created instance" + return "new class name" } @ Class instproc allinstances { @@ -960,25 +941,24 @@ 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: -

-

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 - method. E.g. the following two commands are equivalent + 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). Then <@tt>args is searched for args + starting with '-' followed by an alpha character. These arguments + are called as methods. '-' followed by a numerical is interpreted + as a negative number (and not as a method). If a value of a method + called this way starts with a "a", the call can be placed safely + into a list (e.g. "Class c [-strangearg -a-] -simplearg 2"). + Finally the constructor <@tt>init is called on the object + with all arguments up to the first '-' arg.<@p> + + The <@tt>create method is called implicitly through the + <@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 Car create herby -color red <@/pre> @@ -991,9 +971,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 { @@ -1237,7 +1216,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" @@ -1269,7 +1248,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 { @@ -1328,28 +1307,13 @@ ?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 configure softrecreate. - - See also: <@tt>create + Hook called upon recreation of an object. 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 {