Index: doc/next-migration.html =================================================================== diff -u -r3df933477f01d26d32220be5a1c87bfc0c5b7685 -r46bcd7f85b54540391f426a5ce5d70876bd9aead --- doc/next-migration.html (.../next-migration.html) (revision 3df933477f01d26d32220be5a1c87bfc0c5b7685) +++ doc/next-migration.html (.../next-migration.html) (revision 46bcd7f85b54540391f426a5ce5d70876bd9aead) @@ -551,12 +551,19 @@

This document describes the differences between the Next Scripting Language Framework and XOTcl 1. In particular, it presents a migration guide from XOTcl 1 to NX, and presents potential -incompatibilities beween XOTcl 1.and XOTcl 2

+incompatibilities beween XOTcl 1 and XOTcl 2.

The Next Scripting Language (NX) is a successor of XOTcl 1 and is based on 10 years of experience with XOTcl in projects containing -several hundert thousand lines of code. The overall goal is to -improve the maintainability and stability of large projects, where +several hundert thousand lines of code. While XOTcl was the first +language designed to provide language support for design patterns, the +focus of the Next Scripting Framework and NX are on combining this +with Language Oriented Programming. In many respects, NX was designed +to ease the learning of the language by novices (by using a more +mainstream terminology, higher orthogonality of the methods, less +predefined methods), to improve maintainability (remove sources of +common errors) and to encourage developer to write better structured +programs (to provide interfaces) especially for large projects, where many developers are involved.

The Next Scripting Language is based on the Next Scripting Framework which was developed based on the notion of language oriented @@ -1055,8 +1062,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -

# Define method 'foo' and class-object method 'bar'
-# for a Class 'C' with separate toplevel commands
+
# Define method 'foo' and class-object
+# method 'bar' for a Class 'C' with separate
+# toplevel commands
 
 Class C
 C instproc foo args {...}
@@ -1086,8 +1094,8 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Define method and class-object method with separate
-# commands
+
# Define method and class-object method
+# with separate commands
 
 Class create C
 C method foo args {...}
@@ -1118,8 +1126,9 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Define class-object method and set instance variable
-# in the init-block of an object
+
# Define class-object method and set
+# instance variable in the init-block of
+# an object
 
 Object create o {
   set :x 1
@@ -1134,8 +1143,9 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Define class-object method and set instance variable
-# with separate commands
+
# Define class-object method and set
+# instance variable with separate
+# commands
 
 Object create o
 o eval {set :x 1}
@@ -1615,8 +1625,8 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Set own instance variable to a value via resolver
-# (preferred and fastest way)
+
# Set own instance variable to a value via
+# resolver (preferred and fastest way)
 
 ... method ... {
    set /:newVar/ ?value?
@@ -1645,7 +1655,8 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Set own instance variable via variable import
+
# Set own instance variable via
+# variable import
 
 ... method ... {
    ::nx::var import [self] /varName/
@@ -1772,8 +1783,9 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Set instance variable of object obj to a value via
-# resolver (preferred way: define attribute on obj)
+
# Set instance variable of object obj to a
+# value via resolver
+# (preferred way: define attribute on obj)
 
 /obj/ eval [list set /:varName/ ?value?]
@@ -1797,7 +1809,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Read instance variable of object obj via resolver
+
# Read instance variable of object obj
+# via resolver
 
 set /varName/ [/obj/ eval {set /:otherVar/}]
@@ -1824,7 +1837,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Read instance variable of object /obj/ via import
+
# Read instance variable of object /obj/
+# via import
 
 ... method ... {
    ::nx::var import /obj/ /varName/
@@ -1851,7 +1865,8 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Test existence of instance variable of object obj
+
# Test existence of instance variable of
+# object obj
 
 /obj/ eval {info exists /:varName/}
@@ -1943,8 +1958,9 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Object parameter specified as a list (short form)
-# "a" has no default, "b" has default "1"
+
# Object parameter specified as a list
+# (short form); "a" has no default,
+# "b" has default "1"
 
 Class create Foo -attributes {a {b 1}}
 
@@ -2030,8 +2046,9 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Object parameter specified via attribute methods
-# (allow method modifiers and scripted configuration)
+
# Object parameter specified via attribute
+# methods (supports method modifiers and
+# scripted configuration)
 
 Class create Foo {
    :attribute a
@@ -2086,19 +2103,22 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Object parameter with configured slot, defining an attribute
-# specific type checker
+
# Object parameter with configured slot,
+# defining an attribute specific type
+# checker
 
 Class Person -slots {
-   Attribute create sex -type "sex" {
-     my proc type=sex {name value} {
-       switch -glob $value {
-         m* {return m}
-         f* {return f}
-         default {error "expected sex but got $value"}
-       }
-     }
-   }
+  Attribute create sex -type "sex" {
+    my proc type=sex {name value} {
+      switch -glob $value {
+        m* {return m}
+        f* {return f}
+        default {
+          error "expected sex but got $value"
+        }
+      }
+    }
+  }
 }
-
# Object parameter with scripted definition (init-block),
-# defining an attribute specific type checker
+
# Object parameter with scripted
+# definition (init-block), defining an
+# attribute specific type checker
 
 Class create Person {
-   :attribute sex {
-     :type "sex"
-     :method type=sex {name value} {
-       switch -glob $value {
-         m* {return m}
-         f* {return f}
-         default {error "expected sex but got $value"}
-       }
-     }
-   }
+  :attribute sex {
+    :type "sex"
+    :method type=sex {name value} {
+      switch -glob $value {
+        m* {return m}
+        f* {return f}
+        default {
+          error "expected sex but got $value"
+        }
+      }
+    }
+  }
 }
@@ -2161,7 +2184,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Value constraints for parameter not available
+
# Value constraints for parameter
+# not available
# Predefined value constraints:
-#    object, class, alnum, alpha, ascii, boolean, control,
-#    digit, double, false, graph, integer, lower, parameter,
-#    print, punct,  space, true, upper, wordchar, xdigit
+#    object, class, alnum, alpha, ascii, boolean,
+#    control,  digit, double, false, graph, integer,
+#    lower, parameter, print, punct,  space, true,
+#    upper, wordchar, xdigit
 #
 # User defined value constraints are possible.
-# All parameter value checkers can be turned on and off.
+# All parameter value checkers can be turned on
+# and off.
 #
-# Define a boolean attribute and an integer attribute with a
-# default firstly via "attributes", then with multiple
-# "attribute"  statements.
+# Define a boolean attribute and an integer
+# attribute with a default firstly via "attributes",
+# then with multiple "attribute"  statements.
 
 Class create Foo -attributes {
    a:boolean
@@ -2245,8 +2271,8 @@
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
 
# Required parameter:
-# Define a required attribute a and a required boolean
-# attribute b
+# Define a required attribute "a" and a
+# required boolean attribute "b"
 
 Class create Foo -attributes {
    a:required
@@ -2366,11 +2392,14 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Define method foo with non-positional parameters
-# (x, y and y) and positional parameter (a and b)
+
# Define method foo with non-positional
+# parameters (x, y and y) and positional
+# parameter (a and b)
 
 Class C
-C instproc foo {-x:integer -y:required -z a b} {....}
+C instproc foo {-x:integer -y:required -z a b} {
+   # ...
+}
 C create c1
 
 # invoke method foo
@@ -2384,11 +2413,14 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Define method foo with non-positional parameters
-# (x, y and y) and positional parameter (a and b)
+
# Define method foo with non-positional
+# parameters (x, y and y) and positional
+# parameter (a and b)
 
 Class create C {
-   :public method foo {-x:integer -y:required -z a b} {....}
+   :public method foo {-x:integer -y:required -z a b} {
+      # ...
+   }
    :create c1
 }
 # invoke method foo
@@ -2414,26 +2446,38 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
# Define various forms of parameters not available in XOTcl 1
+
# Define various forms of parameters
+# not available in XOTcl 1
 
 Class create C {
-   # trailing (or interleaved) non-positional parameters
-   :public method m1 {a b -x:integer -y} {....}
+  # trailing (or interleaved) non-positional
+  # parameters
+  :public method m1 {a b -x:integer -y} {
+    # ...
+  }
 
-   # positional parameters with value constraints
-   :public method m2 {a:integer b:boolean} {....}
+  # positional parameters with value constraints
+  :public method m2 {a:integer b:boolean} {
+    #...
+  }
 
-   # optional positional parameter (trailing)
-   :public method set {varName value:optional} {....}
+  # optional positional parameter (trailing)
+  :public method set {varName value:optional} {
+    # ....
+   }
 
-   # parameter with multiplicity
-   :public method m3 {-objs:object,1..n c:class,0..1} {....}
+  # parameter with multiplicity
+  :public method m3 {-objs:object,1..n c:class,0..1} {
+    # ...
+   }
 
-   # In general, the same list of value constraints as for
-   # object parameter is available (see above).
-   #
-   # User defined value constraints are possible.
-   # All parameter value checkers can be turned on and off.
+  # In general, the same list of value
+  # constraints as for object parameter is
+  # available (see above).
+  #
+  # User defined value constraints are
+  # possible. All parameter value checkers
+  # can be turned on and off.
 }
@@ -2481,25 +2525,33 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Define method foo with non-positional parameters
-# (x, y and y) and positional parameter (a and b)
+
# Define method foo with non-positional
+# parameters (x, y and y) and positional
+# parameter (a and b)
 
 Class create C {
-   # Define method foo which returns an integer value
-   :method foo -returns integer {-x:integer} {....}
 
-   # Define an alias for the Tcl command ::incr
-   # and assure, it always returns in integer
-   :alias incr -returns integer ::incr
+  # Define method foo which returns an
+  # integer value
+  :method foo -returns integer {-x:integer} {
+    # ...
+   }
 
-   # Define a forwarder that has to return integer
-   :forward ++ -returns integer ::expr 1 +
+  # Define an alias for the Tcl command ::incr
+  # and assure, it always returns an integer
+  # value
+  :alias incr -returns integer ::incr
 
-  # Define a method that has to return a non-empty
-  # list of objects
-  :public class-object method instances {} -returns object,1..n {
-    return [:info instances]
-   }
+  # Define a forwarder that has to return an
+  # integer value
+  :forward ++ -returns integer ::expr 1 +
+
+ # Define a method that has to return a
+ # non-empty list of objects
+ :public class-object method instances {} \
+    -returns object,1..n {
+   return [:info instances]
+  }
 }
@@ -2555,7 +2607,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Register per-class mixin and guard for a class
+
# Register per-class mixin and guard for
+# a class
 
 /cls/ mixin ...
 /cls/ mixin guard mixin /condition/
@@ -2581,7 +2634,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Register per-object mixin and guard for a class
+
# Register per-object mixin and guard for
+# a class
 
 /cls/ class-object mixin ...
 /cls/ class-object mixin guard mixin /condition/
@@ -2607,7 +2661,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Register per-object mixin and guard for an object
+
# Register per-object mixin and guard for
+# an object
 
 /obj/ mixin ...
 /obj/ mixin guard mixin /condition/
@@ -2653,7 +2708,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Register per-class filter and guard for a class
+
# Register per-class filter and guard for
+# a class
 
 /cls/ filter ...
 /cls/ filter guard filter /condition/
@@ -2679,7 +2735,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Register per-object filter and guard for a class
+
# Register per-object filter and guard for
+# a class
 
 /cls/ class-object filter ...
 /cls/ class-object filter guard filter /condition/
@@ -2705,7 +2762,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# Register per-object filter and guard for an object
+
# Register per-object filter and guard for
+# an object
 
 /obj/ filter ...
 /obj/ filter guard filter /condition/
@@ -3253,7 +3311,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/cls/ class-object info methods -callprotection public|protected ...
+
/cls/ class-object info methods \
+   -callprotection public|protected ...
@@ -3905,10 +3964,12 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# ... info filter methods -order ... returns method-handles
-# instead of triples (applies to all three variants)
+
# ... info filter methods -order ... returns
+# method-handles instead of triples
+# (applies to all three variants)
 
-/obj/ info filter methods ?-guards? ?-order? ?pattern?
+/obj/ info filter methods \ + ?-guards? ?-order? ?pattern?
@@ -3952,7 +4013,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/cls/ class-object info filter methods ?-guards? ?-order? ?pattern?
+
/cls/ class-object info filter methods \
+   ?-guards? ?-order? ?pattern?
@@ -3986,7 +4048,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/cls/ info instfilter ?-guards? ?-order? ?pattern?
+
/cls/ info instfilter \
+   ?-guards? ?-order? ?pattern?
-
/cls/ info filter methods ?-guards? ?-order? ?pattern?
+
/cls/ info filter methods \
+   ?-guards? ?-order? ?pattern?
@@ -4040,7 +4104,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/obj/ info mixin classes ?-guards? ?-order? ?pattern?
+
/obj/ info mixin classes \
+   ?-guards? ?-order? ?pattern?
@@ -4084,7 +4149,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/cls/ class-object info mixin classes ?-guards? ?-order? ?pattern?
+
/cls/ class-object info mixin classes \
+   ?-guards? ?-order? ?pattern?
@@ -4118,7 +4184,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
/cls/ info instmixin ?-guards? ?-order? ?pattern?
+
/cls/ info instmixin \
+   ?-guards? ?-order? ?pattern?
-
/cls/ info mixin classes ?-guards? ?-order? ?pattern?
+
/cls/ info mixin classes \
+   ?-guards? ?-order? ?pattern?
@@ -4394,7 +4462,8 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
# List objects, where /cls/ is a per-object mixin
+
# List objects, where /cls/ is a
+# per-object mixin
 
 /cls/ info mixinof -scope object ?-closure? ?pattern?
@@ -5335,7 +5404,7 @@ Index: doc/next-migration.txt =================================================================== diff -u -r39306d4d36096f20dba3262638e2a87f04e90111 -r46bcd7f85b54540391f426a5ce5d70876bd9aead --- doc/next-migration.txt (.../next-migration.txt) (revision 39306d4d36096f20dba3262638e2a87f04e90111) +++ doc/next-migration.txt (.../next-migration.txt) (revision 46bcd7f85b54540391f426a5ce5d70876bd9aead) @@ -14,7 +14,7 @@ This document describes the differences between the Next Scripting Language Framework and XOTcl 1. In particular, it presents a migration guide from XOTcl 1 to NX, and presents potential -incompatibilities beween XOTcl 1.and XOTcl 2 +incompatibilities beween XOTcl 1 and XOTcl 2. ***************************************************************************** The Next Scripting Language (NX) is a successor of XOTcl 1 and is @@ -324,8 +324,9 @@ |[source,tcl] ---------------- -# Define method 'foo' and class-object method 'bar' -# for a Class 'C' with separate toplevel commands +# Define method 'foo' and class-object +# method 'bar' for a Class 'C' with separate +# toplevel commands Class C C instproc foo args {...} @@ -343,8 +344,8 @@ ---------------- [source,tcl] ---------------- -# Define method and class-object method with separate -# commands +# Define method and class-object method +# with separate commands Class create C C method foo args {...} @@ -363,8 +364,9 @@ |[source,tcl] ---------------- -# Define class-object method and set instance variable -# in the init-block of an object +# Define class-object method and set +# instance variable in the init-block of +# an object Object create o { set :x 1 @@ -373,8 +375,9 @@ ---------------- [source,tcl] ---------------- -# Define class-object method and set instance variable -# with separate commands +# Define class-object method and set +# instance variable with separate +# commands Object create o o eval {set :x 1} @@ -682,8 +685,8 @@ ---------------- |[source,tcl] ---------------- -# Set own instance variable to a value via resolver -# (preferred and fastest way) +# Set own instance variable to a value via +# resolver (preferred and fastest way) ... method ... { set /:newVar/ ?value? @@ -698,7 +701,8 @@ ---------------- |[source,tcl] ---------------- -# Set own instance variable via variable import +# Set own instance variable via +# variable import ... method ... { ::nx::var import [self] /varName/ @@ -759,8 +763,9 @@ ---------------- |[source,tcl] ---------------- -# Set instance variable of object obj to a value via -# resolver (preferred way: define attribute on obj) +# Set instance variable of object obj to a +# value via resolver +# (preferred way: define attribute on obj) /obj/ eval [list set /:varName/ ?value?] ---------------- @@ -770,7 +775,8 @@ ---------------- |[source,tcl] ---------------- -# Read instance variable of object obj via resolver +# Read instance variable of object obj +# via resolver set /varName/ [/obj/ eval {set /:otherVar/}] ---------------- @@ -783,7 +789,8 @@ ---------------- |[source,tcl] ---------------- -# Read instance variable of object /obj/ via import +# Read instance variable of object /obj/ +# via import ... method ... { ::nx::var import /obj/ /varName/ @@ -796,7 +803,8 @@ ---------------- |[source,tcl] ---------------- -# Test existence of instance variable of object obj +# Test existence of instance variable of +# object obj /obj/ eval {info exists /:varName/} ---------------- @@ -850,8 +858,9 @@ ---------------- |[source,tcl] ---------------- -# Object parameter specified as a list (short form) -# "a" has no default, "b" has default "1" +# Object parameter specified as a list +# (short form); "a" has no default, +# "b" has default "1" Class create Foo -attributes {a {b 1}} @@ -902,8 +911,9 @@ |[source,tcl] ---------------- -# Object parameter specified via attribute methods -# (allow method modifiers and scripted configuration) +# Object parameter specified via attribute +# methods (supports method modifiers and +# scripted configuration) Class create Foo { :attribute a @@ -940,37 +950,43 @@ |[source,tcl] ---------------- -# Object parameter with configured slot, defining an attribute -# specific type checker +# Object parameter with configured slot, +# defining an attribute specific type +# checker Class Person -slots { - Attribute create sex -type "sex" { - my proc type=sex {name value} { - switch -glob $value { - m* {return m} - f* {return f} - default {error "expected sex but got $value"} - } - } - } + Attribute create sex -type "sex" { + my proc type=sex {name value} { + switch -glob $value { + m* {return m} + f* {return f} + default { + error "expected sex but got $value" + } + } + } + } } ---------------- |[source,tcl] ---------------- -# Object parameter with scripted definition (init-block), -# defining an attribute specific type checker +# Object parameter with scripted +# definition (init-block), defining an +# attribute specific type checker Class create Person { - :attribute sex { - :type "sex" - :method type=sex {name value} { - switch -glob $value { - m* {return m} - f* {return f} - default {error "expected sex but got $value"} - } - } - } + :attribute sex { + :type "sex" + :method type=sex {name value} { + switch -glob $value { + m* {return m} + f* {return f} + default { + error "expected sex but got $value" + } + } + } + } } ---------------- |====================== @@ -993,21 +1009,24 @@ |[source,tcl] ---------------- -# Value constraints for parameter not available +# Value constraints for parameter +# not available ---------------- |[source,tcl] ---------------- # Predefined value constraints: -# object, class, alnum, alpha, ascii, boolean, control, -# digit, double, false, graph, integer, lower, parameter, -# print, punct, space, true, upper, wordchar, xdigit +# object, class, alnum, alpha, ascii, boolean, +# control, digit, double, false, graph, integer, +# lower, parameter, print, punct, space, true, +# upper, wordchar, xdigit # # User defined value constraints are possible. -# All parameter value checkers can be turned on and off. +# All parameter value checkers can be turned on +# and off. # -# Define a boolean attribute and an integer attribute with a -# default firstly via "attributes", then with multiple -# "attribute" statements. +# Define a boolean attribute and an integer +# attribute with a default firstly via "attributes", +# then with multiple "attribute" statements. Class create Foo -attributes { a:boolean @@ -1042,8 +1061,8 @@ |[source,tcl] ---------------- # Required parameter: -# Define a required attribute a and a required boolean -# attribute b +# Define a required attribute "a" and a +# required boolean attribute "b" Class create Foo -attributes { a:required @@ -1109,23 +1128,29 @@ |[source,tcl] ---------------- -# Define method foo with non-positional parameters -# (x, y and y) and positional parameter (a and b) +# Define method foo with non-positional +# parameters (x, y and y) and positional +# parameter (a and b) Class C -C instproc foo {-x:integer -y:required -z a b} {....} +C instproc foo {-x:integer -y:required -z a b} { + # ... +} C create c1 # invoke method foo c1 foo -x 1 -y a 2 3 ---------------- |[source,tcl] ---------------- -# Define method foo with non-positional parameters -# (x, y and y) and positional parameter (a and b) +# Define method foo with non-positional +# parameters (x, y and y) and positional +# parameter (a and b) Class create C { - :public method foo {-x:integer -y:required -z a b} {....} + :public method foo {-x:integer -y:required -z a b} { + # ... + } :create c1 } # invoke method foo @@ -1138,26 +1163,38 @@ ---------------- |[source,tcl] ---------------- -# Define various forms of parameters not available in XOTcl 1 +# Define various forms of parameters +# not available in XOTcl 1 Class create C { - # trailing (or interleaved) non-positional parameters - :public method m1 {a b -x:integer -y} {....} + # trailing (or interleaved) non-positional + # parameters + :public method m1 {a b -x:integer -y} { + # ... + } - # positional parameters with value constraints - :public method m2 {a:integer b:boolean} {....} + # positional parameters with value constraints + :public method m2 {a:integer b:boolean} { + #... + } - # optional positional parameter (trailing) - :public method set {varName value:optional} {....} + # optional positional parameter (trailing) + :public method set {varName value:optional} { + # .... + } - # parameter with multiplicity - :public method m3 {-objs:object,1..n c:class,0..1} {....} + # parameter with multiplicity + :public method m3 {-objs:object,1..n c:class,0..1} { + # ... + } - # In general, the same list of value constraints as for - # object parameter is available (see above). - # - # User defined value constraints are possible. - # All parameter value checkers can be turned on and off. + # In general, the same list of value + # constraints as for object parameter is + # available (see above). + # + # User defined value constraints are + # possible. All parameter value checkers + # can be turned on and off. } ---------------- |====================== @@ -1180,25 +1217,33 @@ ---------------- |[source,tcl] ---------------- -# Define method foo with non-positional parameters -# (x, y and y) and positional parameter (a and b) +# Define method foo with non-positional +# parameters (x, y and y) and positional +# parameter (a and b) Class create C { - # Define method foo which returns an integer value - :method foo -returns integer {-x:integer} {....} - # Define an alias for the Tcl command ::incr - # and assure, it always returns in integer - :alias incr -returns integer ::incr + # Define method foo which returns an + # integer value + :method foo -returns integer {-x:integer} { + # ... + } - # Define a forwarder that has to return integer - :forward ++ -returns integer ::expr 1 + + # Define an alias for the Tcl command ::incr + # and assure, it always returns an integer + # value + :alias incr -returns integer ::incr - # Define a method that has to return a non-empty - # list of objects - :public class-object method instances {} -returns object,1..n { - return [:info instances] - } + # Define a forwarder that has to return an + # integer value + :forward ++ -returns integer ::expr 1 + + + # Define a method that has to return a + # non-empty list of objects + :public class-object method instances {} \ + -returns object,1..n { + return [:info instances] + } } ---------------- |====================== @@ -1231,7 +1276,8 @@ ---------------- |[source,tcl] ---------------- -# Register per-class mixin and guard for a class +# Register per-class mixin and guard for +# a class /cls/ mixin ... /cls/ mixin guard mixin /condition/ @@ -1243,7 +1289,8 @@ ---------------- |[source,tcl] ---------------- -# Register per-object mixin and guard for a class +# Register per-object mixin and guard for +# a class /cls/ class-object mixin ... /cls/ class-object mixin guard mixin /condition/ @@ -1255,7 +1302,8 @@ ---------------- |[source,tcl] ---------------- -# Register per-object mixin and guard for an object +# Register per-object mixin and guard for +# an object /obj/ mixin ... /obj/ mixin guard mixin /condition/ @@ -1274,7 +1322,8 @@ ---------------- |[source,tcl] ---------------- -# Register per-class filter and guard for a class +# Register per-class filter and guard for +# a class /cls/ filter ... /cls/ filter guard filter /condition/ @@ -1286,7 +1335,8 @@ ---------------- |[source,tcl] ---------------- -# Register per-object filter and guard for a class +# Register per-object filter and guard for +# a class /cls/ class-object filter ... /cls/ class-object filter guard filter /condition/ @@ -1298,7 +1348,8 @@ ---------------- |[source,tcl] ---------------- -# Register per-object filter and guard for an object +# Register per-object filter and guard for +# an object /obj/ filter ... /obj/ filter guard filter /condition/ @@ -1520,7 +1571,8 @@ ---------------- |[source,tcl] ---------------- -/cls/ class-object info methods -callprotection public\|protected ... +/cls/ class-object info methods \ + -callprotection public\|protected ... ---------------- |====================== @@ -1799,10 +1851,12 @@ ---------------- |[source,tcl] ---------------- -# ... info filter methods -order ... returns method-handles -# instead of triples (applies to all three variants) +# ... info filter methods -order ... returns +# method-handles instead of triples +# (applies to all three variants) -/obj/ info filter methods ?-guards? ?-order? ?pattern? +/obj/ info filter methods \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- @@ -1818,7 +1872,8 @@ ---------------- |[source,tcl] ---------------- -/cls/ class-object info filter methods ?-guards? ?-order? ?pattern? +/cls/ class-object info filter methods \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- @@ -1830,11 +1885,13 @@ ---------------- |[source,tcl] ---------------- -/cls/ info instfilter ?-guards? ?-order? ?pattern? +/cls/ info instfilter \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info filter methods ?-guards? ?-order? ?pattern? +/cls/ info filter methods \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- @@ -1850,7 +1907,8 @@ ---------------- |[source,tcl] ---------------- -/obj/ info mixin classes ?-guards? ?-order? ?pattern? +/obj/ info mixin classes \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- @@ -1866,7 +1924,8 @@ ---------------- |[source,tcl] ---------------- -/cls/ class-object info mixin classes ?-guards? ?-order? ?pattern? +/cls/ class-object info mixin classes \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- @@ -1878,11 +1937,13 @@ ---------------- |[source,tcl] ---------------- -/cls/ info instmixin ?-guards? ?-order? ?pattern? +/cls/ info instmixin \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info mixin classes ?-guards? ?-order? ?pattern? +/cls/ info mixin classes \ + ?-guards? ?-order? ?pattern? ---------------- |[source,tcl] ---------------- @@ -1993,7 +2054,8 @@ ---------------- |[source,tcl] ---------------- -# List objects, where /cls/ is a per-object mixin +# List objects, where /cls/ is a +# per-object mixin /cls/ info mixinof -scope object ?-closure? ?pattern? ----------------