Index: TODO =================================================================== diff -u -r731c82615fbab19761efd367c185bd493e94d757 -r268f85047af3501fc9e1b7798b9f3ec51cac77f7 --- TODO (.../TODO) (revision 731c82615fbab19761efd367c185bd493e94d757) +++ TODO (.../TODO) (revision 268f85047af3501fc9e1b7798b9f3ec51cac77f7) @@ -2177,15 +2177,11 @@ TODO: - nsf::proc - * scripted method like implementation + * scripted-method like implementation (like ProcMethodDispatch, not urgent) * toplevel (object less) introspection - * support for serialization in aolserver - * regression tests - * uplevel etc. semantics - * reduce verbosity * memleak testing -- "info method definition" for attributes? +- "info method definition" for :attributes? - check performance implications of value conflict checker Index: doc/next-migration.html =================================================================== diff -u -ra67dbaef19de17336a77df24f280795e88f86956 -r268f85047af3501fc9e1b7798b9f3ec51cac77f7 --- doc/next-migration.html (.../next-migration.html) (revision a67dbaef19de17336a77df24f280795e88f86956) +++ doc/next-migration.html (.../next-migration.html) (revision 268f85047af3501fc9e1b7798b9f3ec51cac77f7) @@ -3,16 +3,29 @@ - + Migration Guide for the the Next Scripting Language -
-Class create Stack {
+
Class create Stack {
 
    #
    # Stack of Things
@@ -754,15 +775,15 @@
    }
 
    :public method push {thing} {
-      set :things [linsert ${:things} 0 $thing]
-      return $thing
-   }
+      set :things [linsert ${:things} 0 $thing]
+      return $thing
+   }
 
    :public method pop {} {
       set top [lindex ${:things} 0]
       set :things [lrange ${:things} 1 end]
-      return $top
-   }
+      return $top
+   }
 }
-
-#
+
#
 # Stack of Things
 #
 
@@ -787,14 +807,14 @@
 
 Stack instproc  push {thing} {
    my instvar things
-   set things [linsert $things 0 $thing]
-   return $thing
-}
+   set things [linsert $things 0 $thing]
+   return $thing
+}
 
 Stack instproc pop {} {
    my instvar things
-   set top [lindex $things 0]
-   set things [lrange $things 1 end]
+   set top [lindex $things 0]
+   set things [lrange $things 1 end]
 }
@@ -845,8 +865,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-   namespace eval mypackage {
+
   namespace eval mypackage {
 
       package require XOTcl 2.0
 
@@ -880,8 +899,19 @@
 

3. XOTcl Idioms in the Next Scripting Language

+

The following sections are intended for reader familiar with XOTcl and +show, how certain language Idioms of XOTcl can be expressed in NX. In +some cases, multiple possible realizations are listed

3.1. Defining Objects and Classes

+

When creating objects or classes, one should use the method create +explicitly. In XOTcl, a default unknown handler was provided for +classes, which create for every unknown method invocation an +object/class with the name of the invoked method. This technique was +convenient, but as well dangerous, since typos in method names lead +easily to unexpected behavior. This default unknown handler is not +provided in NX (but can certainly be provided as a one-liner in NX by +the application).

-
-Class ClassName
+
Class ClassName
+
Class create ClassName
+
Object ObjectName
+
Object create ObjectName
-
-Class create ClassName
@@ -930,8 +958,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-Object ObjectName
-
-Object create ObjectName

3.2. Defining Methods

+

In general, both XOTcl and NX support methods on the object level +(per-object methods, i.e. methods only applicable to a single object) +and on the class level (methods inherited to instances of the +classes). While the naming in XOTcl tried to follow closely the Tcl +tradition (using the term proc for functions/methods), NX uses the +term method for defining scripted methods.

+

XOTcl uses the prefix inst to denote that methods are provided for +instances, calling therefore scripted methods for instances +instproc. This is certainly an unusual term. The approach with the +name prefix has the disadvantage, that for every different kind of +method, two names have to be provided (eg. proc and instproc, +forward and instforward).

+

NX on the contrary uses the same term for defining inherited or +object-specific methods. When the term (e.g. method) is used on a +class, the method will be inherited (applicable to the instances of +the class). When the term is used on an object, an object-specific +method is defined. NX uses the method modifier class-object to +defined a class-method (method for the class-object).

+

Furthermore, both XOTcl and NX distinguish between scripted methods +(section 3.2.1) and C-defined methods (section 3.2.2). Section 3.2.3 +introduces method protection, which is only supported by NX.

3.2.1. Scripted Methods Defined in the Init-block of a Class/Object or with Separate Calls

+

The following examples show the definition of a class and its methods +in the init-block of a class (NX only), and the definition of methods +via separate top level calls (XOTcl and NX).

-
+
# Define method 'foo' and class-object method 'bar'
+# for a Class 'C' with separate toplevel commands
+
 Class C
 C instproc foo args {...}
 C proc bar args {...}
@@ -989,8 +1041,7 @@ .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
+
# Define method and class-object method
 # in the init-block of a class
 
 Class create C {
@@ -1006,8 +1057,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 calls
+
# Define method and class-object method with separate
+# commands
 
 Class create C
 C method foo args {...}
@@ -1023,7 +1074,9 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
+
# Define object-specific method foo
+# for an object 'o' with separate commands
+
 Object o
 o set x 1
 o proc foo args {...}
@@ -1036,8 +1089,7 @@ .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
+
# Define class-object method and set instance variable
 # in the init-block of an object
 
 Object create o {
@@ -1053,8 +1105,7 @@
 .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
+
# Define class-object method and set instance variable
 # with separate commands
 
 Object create o
@@ -1067,6 +1118,9 @@
 
 

3.2.2. Different Kinds of Methods

+

This section describes various kinds of methods. The different kinds +of methods are defined via different method-defining methods, which +are summarized in the following table for XOTcl and NX.

-
-# Methods for defining methods:
+
# Methods for defining methods:
 #
 #     proc
 #     instproc
@@ -1111,8 +1164,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Methods for defining methods:
+
# Methods for defining methods:
 #
 #     method
 #     forward
@@ -1121,44 +1173,31 @@
 #
 # All these methods return method-handles.
+ +
+
+

In addition to scripted methods (previous section) XOTcl supports +forwarder (called forward and instforward) and accessor functions +to variables (called parametercmd and instparametercmd). The +accessor functions are used normally internally when object-specific +parameters are defined (see Section 3.4).

+

In NX forwarders are called forward. NX does not provide an own +method to define variable accessors, but uses the Next Scripting +Framework primitive nsf::setter for it.

+
+ +++ - - + + + + + +
-
-
-Class C
-C instproc foo args {...}
-C proc bar args {...}
-
-Object o
-o proc baz args {...}
-
-
-# Define scripted methods
-
-Class create C {
-  :method foo args {...}
-  :class-object method bar args {...}
-}
-
-Object create o {
-  :method baz args {...}
-}
XOTcl Next Scripting Language
-
-Class C
+
Class C
 C instforward f1 ...
 C forward f2 ...
 
@@ -1185,8 +1223,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Define forwarder
+
# Define forwarder
 
 Class create C {
   :forward f1 ...
@@ -1207,8 +1244,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-Class C
+
Class C
 C instparametercmd p1
 C parametercmd p2
 
@@ -1223,8 +1259,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Define setter and getter methods
+
# Define setter and getter methods
 
 Class create C
 ::nsf::setter C p1
@@ -1233,7 +1268,30 @@
 Object create o
 ::nsf::setter o p3
+
+

NX supports in contrary to XOTcl the method alias which can be used +to register arbitrary Tcl commands or methods for an object or class +under a provided method name. Aliases can be used to reuse a certain implementation in +e.g. different object systems under potentially different names. In +some respects aliases are similar to forwarders, but they do not +involve forwarding overhead.

+
+ +++ + + + + + + +
# Method "alias" not available
- - - -
XOTcl Next Scripting Language
-
-# Method "alias" not available
-
-# Define method aliases
+
# Define method aliases
 # (to scripted or non-scripted methods)
 
 Class create C {
@@ -1267,68 +1323,17 @@
   :alias a3 ...
 }
-
-
-# Parameters only available at class level
-
-Class C \
-   -parameter {
-    x
-    {y 1}
-}
-
-
-# Define object attributes
-# (parameters for initializing objects)
-
-Class create C {
-  :attribute x
-  :attribute {y 1}
-  :class-object attribute oa1
-}
-
-Object create o {
-  :attribute oa2
-}
-
-
-
-Class create C \
-   -attributes {
-    x
-    {y 1}
-}

3.2.3. Method Modifiers and Method Protection

+

NX supports the three method modifiers class-object, public and +protected. All method modifiers can be written in front of every method +defining command. The method modifier class-object is used to denote +class-object specific methods (see above). The concept of method +protection is new in NX.

-
-# Method modifiers
+
# Method modifiers
 #
 #   "class-object",
 #   "public", and
@@ -1370,8 +1374,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Method modifiers orthogonal over all kinds of methods
+
# Method modifiers orthogonal over all kinds of methods
 #
 # Method-definition-methods:
 #    method, forward, alias, attribute
@@ -1388,25 +1391,34 @@
 
 
-

The next scripting language allows to configure the default call -protection in various ways. The command -::nx::configure defaultMethodCallProtection true|false can be used to set the default -call protection for scripted methods, forwarder and aliases, while -::nx::configure defaultAttributeCallProtection true|false can set the -default for attributes.

+

While XOTcl does not provide method protection, in NX, all methods are +defined per default as protected.

+

NX allows to configure the default call protection in various +ways. The command ::nx::configure defaultMethodCallProtection +true|false can be used to set the default call protection for +scripted methods, forwarder and aliases, while ::nx::configure +defaultAttributeCallProtection true|false can set the default +protection for attributes.

3.3. Resolvers

The Next Scripting Framework defines Tcl resolvers for method and -variable names to refer to object specific behavior. Within method -bodies these resolver treat variable and function names starting with -a colon : specially. In short, a colon-prefixed variable name refers -to an instance variable, and a colon-prefixed function name refers to -a method. The sub-sections below provide detailed examples.

-

Note that the Next resolvers can be used in the XOTcl 2.* environment as well.

+variable names to implement object specific behavior. Within the +bodies of scripted methods these resolver treat variable and function +names starting with a colon : specially. In short, a colon-prefixed +variable name refers to an instance variable, and a colon-prefixed +function name refers to a method. The sub-sections below provide +detailed examples.

+

Note that the resolvers of the Next Scripting Framework can be used in +the XOTcl 2.* environment as well.

3.3.1. Invoking Methods

+

In XOTcl, a method of the same object can be invoked via my, or in +general via using the name of the object in front of the method name.

+

In NX, the own methods are called via the method name prefixed with a +single colon. The invocation of the methods of other objects is the +same in NX and XOTcl.

-
-Class C
+
Class C
 C instproc foo args {...}
 C instproc bar args {
   my foo 1 2 3 ;# invoke own method
@@ -1449,8 +1460,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-Class create C {
+
Class create C {
   :method foo args {...}
   :method bar args {
      :foo 1 2 3 ;# invoke own method
@@ -1469,17 +1479,37 @@
 

3.3.2. Accessing Own Instance Variables from Method Bodies

In general, the Next Scripting Language favors the access to an objects’s own instance variables over variable accesses of other -objects. On the contrary, in XOTcl, the variable access to own and -other variables are completely symmetric.

-

In Next Scripting, access to local variables are performed via -primarily via name resolvers, but using the standard tcl commands -(like e.g. set, incr, append, info exists, etc.). In XOTcl, it -is common to provide same-named methods registered on -::xotcl::Object for such purposes. This is one of the reasons, why -the Next Scripting Language has a much smaller interface (less -predefined methods). It is possible for an application program to -register XOTcl-like methods in the Next Scripting Language via the -primitives of the Next Scripting Framework.

+objects. This means that in NX it is syntactically easier to access +the own instance variables. On the contrary, in XOTcl, the variable +access to own and other variables are fully symmetric.

+

In XOTcl, the following approaches are used to access instance +variables:

+
    +
  • +

    +Import instance variables via instvar and access variables via $varName +

    +
  • +
  • +

    +Set or get instance variables via my set varName ?value? or other + variable accessing methods registered on xotcl::Object such as + append, lappend, incr, etc. +

    +
  • +
  • +

    +Register same-named accessor functions and set/get values + of instance variables via my varName ?value? +

    +
  • +
+

In NX, the favored approach to access instance variables is to use +the name resolvers, although it is as well possible to import +variables via nx::var import or to check for the existence of +instance variables via nx::var exists.

+

The following examples summary the use cases for accessing the own and +other instance variables.

-
-Class C
+
Class C
 C instproc foo args {
   # Method scoped variable a
   set a 1
@@ -1524,8 +1553,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-Class create C {
+
Class create C {
   :method foo args {...}
     # Method scoped variable a
     set a 1
@@ -1546,8 +1574,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-... instproc ... {
+
... instproc ... {
    my set /varName/ ?value?
 }
@@ -1591,8 +1616,7 @@ .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/
@@ -1609,8 +1633,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-... instproc ... {
+
... instproc ... {
    set /varName/ [my set /otherVar/]
 }
@@ -1652,8 +1673,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-... instproc ... {
+
... instproc ... {
    my exists /varName/
 }
@@ -1715,8 +1733,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ set /varName/ ?value?
+
/obj/ set /varName/ ?value?
@@ -1742,8 +1758,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-set /varName/ [/obj/ set /otherVar/]
+
set /varName/ [/obj/ set /otherVar/]
@@ -1768,8 +1782,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-... instproc ... {
+
... instproc ... {
    /obj/ instvar /varName/
    set /varName/ ?value?
 }
@@ -1782,8 +1795,7 @@ .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/
@@ -1800,8 +1812,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-/obj/ exists varName
+
/obj/ exists varName
+
::nx::var exists /obj/ /varName/
@@ -1559,8 +1586,7 @@ .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
+
# Set own instance variable to a value via resolver
 # (preferred and fastest way)
 
 ... method ... {
@@ -1577,8 +1603,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-... instproc ... {
+
... instproc ... {
    my instvar /varName/
    set /varName/ ?value?
 }
@@ -1622,8 +1645,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# Read own instance variable
+
# Read own instance variable
 
 ... method ... {
    set /varName/ [set /:otherVar/]
@@ -1637,8 +1659,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-... method ... {
+
... method ... {
    set /newVar/ ${/:otherVar/}
 }
@@ -1665,8 +1685,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# Test existence of own instance variable
+
# Test existence of own instance variable
 
 ... method ... {
    info /:varName/
@@ -1680,8 +1699,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
- ... method ... {
+
 ... method ... {
    ::nx::var exists [self] /varName/
 }
-
-# Set instance variable of object obj to a value via
+
# Set instance variable of object obj to a value via
 # resolver (preferred way: define attribute on obj)
 
 /obj/ eval [list set /:varName/ ?value?]
-
-# Read instance variable of object obj via resolver
+
# Read instance variable of object obj via resolver
 
 set /varName/ [/obj/ eval {set /:otherVar/}]
-
-# Test existence of instance variable of object obj
+
# Test existence of instance variable of object obj
 
 /obj/ eval {info exists /:varName/}
@@ -1824,8 +1834,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-::nx::var exists /obj/ /varName/
@@ -1867,8 +1876,7 @@ .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)
+
# Object parameter specified as a list (short form)
 # "a" has no default, "b" has default "1"
 
 Class Foo -parameter {a {b 1}}
@@ -1886,8 +1894,7 @@
 .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)
+
# Object parameter specified as a list (short form)
 # "a" has no default, "b" has default "1"
 
 Class create Foo -attributes {a {b 1}}
@@ -1907,9 +1914,61 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Object parameter specified via slots
+
# Parameters only available at class level
 
+Class C \
+   -parameter {
+    x
+    {y 1}
+}
+
+
+
# Define object attributes
+# (parameters for initializing objects)
+
+Class create C {
+  :attribute x
+  :attribute {y 1}
+  :class-object attribute oa1
+}
+
+Object create o {
+  :attribute oa2
+}
+
+
+
Class create C \
+   -attributes {
+    x
+    {y 1}
+}
+ + +
+
+
# Object parameter specified via slots
+
 Class Foo -slots {
    Attribute a
    Attribute b -default 1
@@ -1929,8 +1988,7 @@
 .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
+
# Object parameter specified via attribute methods
 # (allow method modifieres and scripted configuration)
 
 Class create Foo {
@@ -1953,14 +2011,13 @@
 .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
+
# 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 {
+       switch -glob $value {
          m* {return m}
          f* {return f}
          default {error "expected sex but got $value"}
@@ -1977,15 +2034,14 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Object parameter with scripted definition, defining an attribute
+
# Object parameter with scripted definition, defining an attribute
 # specific type checker
 
 Class create Person {
    :attribute sex {
      :type "sex"
      :method type=sex {name value} {
-       switch -glob $value {
+       switch -glob $value {
          m* {return m}
          f* {return f}
          default {error "expected sex but got $value"}
@@ -2004,8 +2060,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Predefined value constraints for parameter not available
+
# Predefined value constraints for parameter not available
-
-# Predefined value constraints:
+
# Predefined value constraints:
 #    object, class, alnum, alpha, ascii, boolean, control,
 #    digit, double, false, graph, integer, lower, print,
 #    punct,  space, true, upper, wordchar, xdigit
@@ -2040,8 +2094,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-Class create Foo {
+
Class create Foo {
    :attribute a:boolean
    :attribute {b:integer 1}
 }
@@ -2056,8 +2109,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# Required parameter not available
+
# Required parameter not available
-
-# Required parameter:
+
# Required parameter:
 # Define a required attribute a and a required boolean
 # attribute b
 
@@ -2086,7 +2137,6 @@
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
 
-
 Class create Foo {
    :attribute a:required
    :attribute b:boolean,required
@@ -2102,8 +2152,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# Multiplicity for parameter not available
+
# Multiplicity for parameter not available
-
-# Parameter with multiplicity
+
# Parameter with multiplicity
 
 Class create Foo -attributes {
   {ints:integer,0..n ""} ;# list of integers, with default
@@ -2130,8 +2178,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-Class create Foo {
+
Class create Foo {
   :attribute {ints:integer,0..n ""}
    :attribute objs:object,1..n
    :attribute obj:object,0..1
@@ -2172,8 +2219,7 @@
 .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
+
# Define method foo with non-positional parameters
 # (x, y and y) and positional parameter (a and b)
 
 Class C
@@ -2191,8 +2237,7 @@
 .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
+
# Define method foo with non-positional parameters
 # (x, y and y) and positional parameter (a and b)
 
 Class create C {
@@ -2212,8 +2257,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# n.a.
+
# n.a.
-
-# 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
@@ -2281,8 +2324,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# n.a.
+
# n.a.
-
-# Define method foo with non-positional parameters
+
# Define method foo with non-positional parameters
 # (x, y and y) and positional parameter (a and b)
 
 Class create C {
@@ -2347,8 +2388,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-/cls/ instmixin ...
+
/cls/ instmixin ...
 /cls/ instmixinguard mixin /condition/
-
-# 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/
@@ -2375,8 +2414,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ mixin ...
+
/cls/ mixin ...
 /cls/ mixin guard mixin /condition/
-
-# 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/
@@ -2403,8 +2440,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ mixin ...
+
/obj/ mixin ...
 /obj/ mixinguard mixin /condition/
-
-# 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/
@@ -2451,8 +2486,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ instfilter ...
+
/cls/ instfilter ...
 /cls/ instfilterguard filter /condition/
-
-# 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/
@@ -2479,8 +2512,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ filter ...
+
/cls/ filter ...
 /cls/ filterguard ...
-
-# 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/
@@ -2507,8 +2538,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ filter ...
+
/obj/ filter ...
 /obj/ filterguard filter /condition/
-
-# 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/
@@ -2558,8 +2587,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info commands ?pattern?
+
/obj/ info commands ?pattern?
-
-/obj/ info methods ?pattern?
+
/obj/ info methods ?pattern?
@@ -2582,8 +2609,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info parametercmd ?pattern?
+
/obj/ info parametercmd ?pattern?
-
-/obj/ info methods -methodtype setter ?pattern?
+
/obj/ info methods -methodtype setter ?pattern?
@@ -2606,8 +2631,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info procs ?pattern?
+
/obj/ info procs ?pattern?
-
-/obj/ info methods -methodtype scripted ?pattern?
+
/obj/ info methods -methodtype scripted ?pattern?
@@ -2630,8 +2653,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info methods -methodtype alias ?pattern?
+
/obj/ info methods -methodtype alias ?pattern?
@@ -2654,8 +2675,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info methods -methodtype forwarder ?pattern?
+
/obj/ info methods -methodtype forwarder ?pattern?
@@ -2678,8 +2697,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info methods -methodtype object ?pattern?
+
/obj/ info methods -methodtype object ?pattern?
@@ -2702,8 +2719,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info methods -callprotection public|protected ...
+
/obj/ info methods -callprotection public|protected ...
@@ -2746,8 +2761,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instcommands ?pattern?
+
/cls/ info instcommands ?pattern?
-
-/cls/ info methods ?pattern?
+
/cls/ info methods ?pattern?
@@ -2770,8 +2783,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instparametercmd ?pattern?
+
/cls/ info instparametercmd ?pattern?
-
-/cls/ info methods -methodtype setter ?pattern?
+
/cls/ info methods -methodtype setter ?pattern?
@@ -2794,8 +2805,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instprocs ?pattern?
+
/cls/ info instprocs ?pattern?
-
-/cls/ info methods -methodtype scripted ?pattern?
+
/cls/ info methods -methodtype scripted ?pattern?
@@ -2818,8 +2827,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ info methods -methodtype alias ?pattern?
+
/cls/ info methods -methodtype alias ?pattern?
@@ -2842,8 +2849,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ info methods -methodtype forwarder ?pattern?
+
/cls/ info methods -methodtype forwarder ?pattern?
@@ -2866,8 +2871,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ info methods -methodtype object ?pattern?
+
/cls/ info methods -methodtype object ?pattern?
@@ -2890,8 +2893,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ info methods -callprotection public|protected ...
+
/cls/ info methods -callprotection public|protected ...
@@ -2934,8 +2935,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info commands ?pattern?
+
/cls/ info commands ?pattern?
-
-/cls/ class-object info methods ?pattern?
+
/cls/ class-object info methods ?pattern?
@@ -2958,8 +2957,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info parametercmd ?pattern?
+
/cls/ info parametercmd ?pattern?
-
-/cls/ class-object info methods -methodtype setter ?pattern?
+
/cls/ class-object info methods -methodtype setter ?pattern?
@@ -2982,8 +2979,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info procs ?pattern?
+
/cls/ info procs ?pattern?
-
-/cls/ class-object info methods -methodtype scripted ?pattern?
+
/cls/ class-object info methods -methodtype scripted ?pattern?
@@ -3006,8 +3001,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ class-object info methods -methodtype alias ?pattern?
+
/cls/ class-object info methods -methodtype alias ?pattern?
@@ -3030,8 +3023,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ class-object info methods -methodtype forwarder ?pattern?
+
/cls/ class-object info methods -methodtype forwarder ?pattern?
@@ -3054,8 +3045,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ class-object info methods -methodtype object ?pattern?
+
/cls/ class-object info methods -methodtype object ?pattern?
@@ -3078,8 +3067,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ class-object info methods -callprotection public|protected ...
+
/cls/ class-object info methods -callprotection public|protected ...
@@ -3122,8 +3109,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info methods ?pattern?
+
/obj/ info methods ?pattern?
-
-/obj/ info lookup methods ... ?pattern?
+
/obj/ info lookup methods ... ?pattern?
 # Returns list of method names
@@ -3147,8 +3132,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-# List only application specific methods
+
# List only application specific methods
 /obj/ info lookup methods -source application ... ?pattern?
 # Returns list of method names
@@ -3173,8 +3156,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# Options for 'info methods'
+
# Options for 'info methods'
 #
 # -incontext
 # -nomixins
@@ -3187,8 +3169,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# Options for 'info lookup methods'
+
# Options for 'info lookup methods'
 #
 # -source ...
 # -callprotection ...
@@ -3206,8 +3187,7 @@
 .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
 .nx-variable    {color: #AF663F; font-weight: normal; font-style: normal;}
 
-
-# n.a.
+
# n.a.
-
-# List slot objects defined for obj
+
# List slot objects defined for obj
 /obj/ info lookup slots
 # Returns list of slot objects
@@ -3252,8 +3231,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ procsearch /methodName/
+
/obj/ procsearch /methodName/
-
-/obj/ info lookup method /methodName/
+
/obj/ info lookup method /methodName/
 # Returns method-handle
@@ -3277,8 +3254,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ filtersearch /methodName/
+
/obj/ filtersearch /methodName/
-
-/obj/ info lookup filter /methodName/
+
/obj/ info lookup filter /methodName/
 # Returns method-handle
@@ -3322,8 +3297,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instbody /methodName/
+
/cls/ info instbody /methodName/
-
-/cls/ info method body /methodName/
+
/cls/ info method body /methodName/
@@ -3346,8 +3319,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instargs /methodName/
+
/cls/ info instargs /methodName/
-
-/cls/ info method args /methodName/
+
/cls/ info method args /methodName/
@@ -3370,8 +3341,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instnonposargs /methodName/
+
/cls/ info instnonposargs /methodName/
-
-/cls/ info method parameter /methodName/
+
/cls/ info method parameter /methodName/
@@ -3394,8 +3363,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instdefault /methodName/
+
/cls/ info instdefault /methodName/
-
-/cls/ info instdefault /methodName/
+
/cls/ info instdefault /methodName/
@@ -3418,8 +3385,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instpre /methodName/
+
/cls/ info instpre /methodName/
-
-/cls/ info method precondition /methodName/
+
/cls/ info method precondition /methodName/
@@ -3442,8 +3407,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instpost /methodName/
+
/cls/ info instpost /methodName/
-
-/cls/ info method postcondition /methodName/
+
/cls/ info method postcondition /methodName/
@@ -3466,8 +3429,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ info method definition /methodName/
+
/cls/ info method definition /methodName/
@@ -3510,8 +3471,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info body /methodName/
+
/obj/ info body /methodName/
-
-/obj/ info method body /methodName/
+
/obj/ info method body /methodName/
@@ -3534,8 +3493,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info args /methodName/
+
/obj/ info args /methodName/
-
-/obj/ info method args /methodName/
+
/obj/ info method args /methodName/
@@ -3558,8 +3515,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info nonposargs /methodName/
+
/obj/ info nonposargs /methodName/
-
-/obj/ info method parameter /methodName/
+
/obj/ info method parameter /methodName/
@@ -3582,8 +3537,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info default /methodName/
+
/obj/ info default /methodName/
-
-/obj/ info method parameter /methodName/
+
/obj/ info method parameter /methodName/
@@ -3606,8 +3559,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info pre /methodName/
+
/obj/ info pre /methodName/
-
-/obj/ info method precondition /methodName/
+
/obj/ info method precondition /methodName/
@@ -3630,8 +3581,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info pre /methodName/
+
/obj/ info pre /methodName/
-
-/obj/ info method precondition /methodName/
+
/obj/ info method precondition /methodName/
@@ -3654,8 +3603,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info post /methodName/
+
/obj/ info post /methodName/
-
-/obj/ info post /methodName/
+
/obj/ info post /methodName/
@@ -3678,8 +3625,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info method definition /methodName/
+
/obj/ info method definition /methodName/
@@ -3723,8 +3668,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info filter ?-guards? ?-order? ?pattern?
+
/obj/ info filter ?-guards? ?-order? ?pattern?
-
-# ... info filter methods -order ... returns method-handles
+
# ... info filter methods -order ... returns method-handles
 # instead of triples (applies to all three variants)
 
 /obj/ info filter methods ?-guards? ?-order? ?pattern?
@@ -3750,8 +3693,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info filterguard /name/
+
/obj/ info filterguard /name/
-
-/obj/ info filter guard /name/
+
/obj/ info filter guard /name/
@@ -3774,8 +3715,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info filter ?-guards? ?-order? ?pattern?
+
/cls/ info filter ?-guards? ?-order? ?pattern?
-
-/cls/ class-object info filter methods ?-guards? ?-order? ?pattern?
+
/cls/ class-object info filter methods ?-guards? ?-order? ?pattern?
@@ -3798,8 +3737,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info filterguard /name/
+
/cls/ info filterguard /name/
-
-/cls/ class-object info filter guard /name/
+
/cls/ class-object info filter guard /name/
@@ -3822,8 +3759,7 @@ .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?
@@ -3846,8 +3781,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instfilterguard /name/
+
/cls/ info instfilterguard /name/
-
-/cls/ info filter guard /name/
+
/cls/ info filter guard /name/
@@ -3870,8 +3803,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info mixin ?-guards? ?-order? ?pattern?
+
/obj/ info mixin ?-guards? ?-order? ?pattern?
-
-/obj/ info mixin classes ?-guards? ?-order? ?pattern?
+
/obj/ info mixin classes ?-guards? ?-order? ?pattern?
@@ -3894,8 +3825,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info mixinguard /name/
+
/obj/ info mixinguard /name/
-
-/obj/ info mixin guard /name/
+
/obj/ info mixin guard /name/
@@ -3918,8 +3847,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info mixin ?-guards? ?-order? ?pattern?
+
/cls/ info mixin ?-guards? ?-order? ?pattern?
-
-/cls/ class-object info mixin classes ?-guards? ?-order? ?pattern?
+
/cls/ class-object info mixin classes ?-guards? ?-order? ?pattern?
@@ -3942,8 +3869,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info mixinguard /name/
+
/cls/ info mixinguard /name/
-
-/cls/ class-object info mixin guard /name/
+
/cls/ class-object info mixin guard /name/
@@ -3966,8 +3891,7 @@ .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?
@@ -3990,8 +3913,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instmixinguard /name/
+
/cls/ info instmixinguard /name/
-
-/cls/ info mixin guard /name/
+
/cls/ info mixin guard /name/
@@ -4034,8 +3955,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info method definition /methodName/
+
/obj/ info method definition /methodName/
@@ -4058,8 +3977,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ info method definition /methodName/
+
/cls/ info method definition /methodName/
@@ -4102,8 +4019,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info method handle /methodName/
+
/obj/ info method handle /methodName/
@@ -4126,8 +4041,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ ?class-object? info method handle /methodName/
+
/cls/ ?class-object? info method handle /methodName/
@@ -4170,8 +4083,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info method type /methodName/
+
/obj/ info method type /methodName/
@@ -4194,8 +4105,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/cls/ ?class-object? info method type /methodName/
+
/cls/ ?class-object? info method type /methodName/
@@ -4238,8 +4147,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info mixinof ?-closure? ?pattern?
+
/cls/ info mixinof ?-closure? ?pattern?
-
-# 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?
@@ -4264,8 +4171,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instmixinof ?-closure? ?pattern?
+
/cls/ info instmixinof ?-closure? ?pattern?
-
-# List classes, where /cls/ is a per-class mixin
+
# List classes, where /cls/ is a per-class mixin
 
 /cls/ info mixinof -scope class ?-closure? ?pattern?
@@ -4290,8 +4195,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-# List objects and classes, where /cls/ is
+
# List objects and classes, where /cls/ is
 # either a per-object or a per-class mixin
 
 /cls/ info mixinof -scope all ?-closure? ?pattern?
@@ -4315,8 +4218,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info mixinof ?-closure? ?pattern?
+
/cls/ info mixinof ?-closure? ?pattern?
@@ -4348,8 +4250,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ istype /sometype/
+
/obj/ istype /sometype/
-
-/obj/ info has type /sometype/
+
/obj/ info has type /sometype/
@@ -4372,8 +4272,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ ismixin /cls/
+
/obj/ ismixin /cls/
-
-/obj/ info has mixin /cls/
+
/obj/ info has mixin /cls/
@@ -4396,8 +4294,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ isclass ?/cls/?
+
/obj/ isclass ?/cls/?
-
-/obj/ info is class
+
/obj/ info is class
@@ -4420,8 +4316,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ ismetaclass /cls/
+
/obj/ ismetaclass /cls/
-
-/obj/ info is metaclass
+
/obj/ info is metaclass
@@ -4444,8 +4338,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-# n.a.
+
# n.a.
-
-/obj/ info is baseclass
+
/obj/ info is baseclass
@@ -4468,8 +4360,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ isobject /obj/
+
/obj/ isobject /obj/
-
-::nsf::isobject /obj/
+
::nsf::isobject /obj/
@@ -4512,8 +4402,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self
+
self
-
-current
+
current
-
-current object
+
current object
@@ -4547,8 +4434,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self class
+
self class
-
-current class
+
current class
@@ -4571,8 +4456,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self proc
+
self proc
-
-current method
+
current method
@@ -4595,8 +4478,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self callingclass
+
self callingclass
-
-current currentclass
+
current currentclass
@@ -4619,8 +4500,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self callingobject
+
self callingobject
-
-current callingobject
+
current callingobject
@@ -4643,8 +4522,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self callingproc
+
self callingproc
-
-current callingmethod
+
current callingmethod
@@ -4667,8 +4544,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self calledclass
+
self calledclass
-
-current calledclass
+
current calledclass
@@ -4691,8 +4566,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self calledproc
+
self calledproc
-
-current calledmethod
+
current calledmethod
@@ -4715,8 +4588,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self isnextcall
+
self isnextcall
-
-current isnextcall
+
current isnextcall
@@ -4739,8 +4610,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self next
+
self next
-
-# Returns method-handle
+
# Returns method-handle
 current next
@@ -4764,8 +4633,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self filterreg
+
self filterreg
-
-# Returns method-handle
+
# Returns method-handle
 current filterreg
@@ -4789,8 +4656,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self callinglevel
+
self callinglevel
-
-current callinglevel
+
current callinglevel
@@ -4813,8 +4678,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-self activelevel
+
self activelevel
-
-current activelevel
+
current activelevel
@@ -4858,8 +4721,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ requireNamespace
+
/obj/ requireNamespace
-
-/obj/ require namespace
+
/obj/ require namespace
@@ -4906,8 +4767,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ check /checkoptions/
+
/obj/ check /checkoptions/
-
-::nsf::assertion /obj/ check /checkptions/
+
::nsf::assertion /obj/ check /checkptions/
@@ -4930,8 +4789,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info check
+
/obj/ info check
-
-::nsf::assertion /obj/ check
+
::nsf::assertion /obj/ check
@@ -4954,8 +4811,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ invar /conditions/
+
/obj/ invar /conditions/
-
-::nsf::assertion /obj/ object-invar /conditions/
+
::nsf::assertion /obj/ object-invar /conditions/
@@ -4978,8 +4833,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/obj/ info invar
+
/obj/ info invar
-
-::nsf::assertion /obj/ object-invar
+
::nsf::assertion /obj/ object-invar
@@ -5002,8 +4855,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ instinvar /conditions/
+
/cls/ instinvar /conditions/
-
-::nsf::assertion /cls/ class-invar /conditions/
+
::nsf::assertion /cls/ class-invar /conditions/
@@ -5026,8 +4877,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info instinvar
+
/cls/ info instinvar
-
-::nsf::assertion /cls/ class-invar
+
::nsf::assertion /cls/ class-invar
@@ -5050,8 +4899,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ invar /conditions/
+
/cls/ invar /conditions/
-
-::nsf::assertion /cls/ object-invar /conditions/
+
::nsf::assertion /cls/ object-invar /conditions/
@@ -5074,8 +4921,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-/cls/ info invar
+
/cls/ info invar
-
-::nsf::assertion /cls/ object-invar
+
::nsf::assertion /cls/ object-invar
@@ -5132,8 +4977,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-Class Foo -parameter {x y}
+
Class Foo -parameter {x y}
 Foo f1 -x -y 1

Such cases are most likely mistakes. All parameter configurations in XOTcl 2 require an argument.

@@ -5153,8 +4997,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-Class Foo -parameter {{x 1}}
+
Class Foo -parameter {{x 1}}
 Class Bar -superclass Foo -parameter x
 Bar b1
@@ -5175,8 +5018,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
-Foo::slot::ints foo ...
+
Foo::slot::ints foo ...
 Foo slot ints foo ...

In the Next Scripting Framework, only the first form has the same semantic as before. In the second form (invocation of objects via @@ -5216,8 +5058,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -

-::nsf::exithandler set|get|unset ?arg?
+
::nsf::exithandler set|get|unset ?arg?
@@ -5226,7 +5067,7 @@ Index: doc/next-migration.txt =================================================================== diff -u -r1a05667da4190fc231eb30304adc739d38202bf2 -r268f85047af3501fc9e1b7798b9f3ec51cac77f7 --- doc/next-migration.txt (.../next-migration.txt) (revision 1a05667da4190fc231eb30304adc739d38202bf2) +++ doc/next-migration.txt (.../next-migration.txt) (revision 268f85047af3501fc9e1b7798b9f3ec51cac77f7) @@ -80,8 +80,20 @@ Info methods for Objects: :: 25 Info method for Classes: :: 24 -Below is a small, introductory example showing an implementation of a stack in NX and XOTcl. +Below is a small, introductory example showing an implementation of a +class +Stack+ in NX and XOTcl. NX supports a block syntax, where the +methods are defined during the creation of the class. The XOTcl syntax +is slightly more redundant, since every definition of a method is a +single toplevel command starting with the class name (also NX supports +the style used in XOTcl). In NX, all methods are per default +protected (XOTcl does not support protection). In NX methods are +defined in the definition of the class via +:method+ or +:public +method+. In XOTcl methods are defined via the +instproc+ method. +Another difference is the notation to refere to instance variables. In +NX, instance variable are named with a single colon in the front. In +XOTcl, instance variables are imported using +instvar+. + [options="header",cols="asciidoc,asciidoc",frame="none"] |====================== |Stack example in NX |Stack example in XOTcl @@ -197,8 +209,22 @@ XOTcl Idioms in the Next Scripting Language --------------------------------------------- +The following sections are intended for reader familiar with XOTcl and +show, how certain language Idioms of XOTcl can be expressed in NX. In +some cases, multiple possible realizations are listed + Defining Objects and Classes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When creating objects or classes, one should use the method +create+ +explicitly. In XOTcl, a default +unknown+ handler was provided for +classes, which create for every unknown method invocation an +object/class with the name of the invoked method. This technique was +convenient, but as well dangerous, since typos in method names lead +easily to unexpected behavior. This default unknown handler is not +provided in NX (but can certainly be provided as a one-liner in NX by +the application). + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -226,13 +252,46 @@ Defining Methods ~~~~~~~~~~~~~~~~ +In general, both XOTcl and NX support methods on the object level +(per-object methods, i.e. methods only applicable to a single object) +and on the class level (methods inherited to instances of the +classes). While the naming in XOTcl tried to follow closely the Tcl +tradition (using the term +proc+ for functions/methods), NX uses the +term +method+ for defining scripted methods. + +XOTcl uses the prefix +inst+ to denote that methods are provided for +instances, calling therefore scripted methods for instances ++instproc+. This is certainly an unusual term. The approach with the +name prefix has the disadvantage, that for every different kind of +method, two names have to be provided (eg. +proc+ and +instproc+, ++forward+ and +instforward+). + +NX on the contrary uses the same term for defining inherited or +object-specific methods. When the term (e.g. +method+) is used on a +class, the method will be inherited (applicable to the instances of +the class). When the term is used on an object, an object-specific +method is defined. NX uses the method modifier +class-object+ to +defined a class-method (method for the class-object). + +Furthermore, both XOTcl and NX distinguish between scripted methods +(section 3.2.1) and C-defined methods (section 3.2.2). Section 3.2.3 +introduces method protection, which is only supported by NX. + ==== Scripted Methods Defined in the Init-block of a Class/Object or with Separate Calls + +The following examples show the definition of a class and its methods +in the init-block of a class (NX only), and the definition of methods +via separate top level calls (XOTcl and NX). + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- +# Define method 'foo' and class-object method 'bar' +# for a Class 'C' with separate toplevel commands + Class C C instproc foo args {...} C proc bar args {...} @@ -249,7 +308,8 @@ ---------------- [source,tcl] ---------------- -# Define method and class-object method with separate calls +# Define method and class-object method with separate +# commands Class create C C method foo args {...} @@ -258,6 +318,9 @@ |[source,tcl] ---------------- +# Define object-specific method foo +# for an object 'o' with separate commands + Object o o set x 1 o proc foo args {...} @@ -285,6 +348,11 @@ |=========================== ==== Different Kinds of Methods + +This section describes various kinds of methods. The different kinds +of methods are defined via different method-defining methods, which +are summarized in the following table for XOTcl and NX. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -314,31 +382,22 @@ # # All these methods return method-handles. ---------------- +|=========================== -|[source,tcl] ----------------- -Class C -C instproc foo args {...} -C proc bar args {...} +In addition to scripted methods (previous section) XOTcl supports +forwarder (called +forward+ and +instforward+) and accessor functions +to variables (called +parametercmd+ and +instparametercmd+). The +accessor functions are used normally internally when object-specific +parameters are defined (see Section 3.4). -Object o -o proc baz args {...} ----------------- +In NX forwarders are called +forward+. NX does not provide an own +method to define variable accessors, but uses the Next Scripting +Framework primitive +nsf::setter+ for it. -|[source,tcl] ----------------- -# Define scripted methods +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language -Class create C { - :method foo args {...} - :class-object method bar args {...} -} - -Object create o { - :method baz args {...} -} ----------------- - |[source,tcl] ---------------- Class C @@ -384,8 +443,19 @@ Object create o ::nsf::setter o p3 ---------------- +|====================== +NX supports in contrary to XOTcl the method +alias+ which can be used +to register arbitrary Tcl commands or methods for an object or class +under a provided method name. Aliases can be used to reuse a certain implementation in +e.g. different object systems under potentially different names. In +some respects aliases are similar to forwarders, but they do not +involve forwarding overhead. +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + |[source,tcl] ---------------- # Method "alias" not available @@ -405,47 +475,19 @@ :alias a3 ... } ---------------- - -|[source,tcl] ----------------- -# Parameters only available at class level - -Class C \ - -parameter { - x - {y 1} -} ----------------- - -|[source,tcl] ----------------- -# Define object attributes -# (parameters for initializing objects) - -Class create C { - :attribute x - :attribute {y 1} - :class-object attribute oa1 -} - -Object create o { - :attribute oa2 -} ----------------- -[source,tcl] ----------------- -Class create C \ - -attributes { - x - {y 1} -} ----------------- |=========================== [[method-protect-example]] ==== Method Modifiers and Method Protection +NX supports the three method modifiers +class-object+, +public+ and ++protected+. All method modifiers can be written in front of every method +defining command. The method modifier +class-object+ is used to denote +class-object specific methods (see above). The concept of method +protection is new in NX. + + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -478,27 +520,39 @@ ---------------- |====================== -The next scripting language allows to configure the default call -protection in various ways. The command -`::nx::configure defaultMethodCallProtection true|false` can be used to set the default -call protection for scripted methods, forwarder and aliases, while -`::nx::configure defaultAttributeCallProtection true|false` can set the -default for attributes. +While XOTcl does not provide method protection, in NX, all methods are +defined per default as protected. +NX allows to configure the default call protection in various +ways. The command `::nx::configure defaultMethodCallProtection +true|false` can be used to set the default call protection for +scripted methods, forwarder and aliases, while `::nx::configure +defaultAttributeCallProtection true|false` can set the default +protection for attributes. + === Resolvers The Next Scripting Framework defines Tcl resolvers for method and -variable names to refer to object specific behavior. Within method -bodies these resolver treat variable and function names starting with -a colon `:` specially. In short, a colon-prefixed variable name refers -to an instance variable, and a colon-prefixed function name refers to -a method. The sub-sections below provide detailed examples. +variable names to implement object specific behavior. Within the +bodies of scripted methods these resolver treat variable and function +names starting with a colon `:` specially. In short, a colon-prefixed +variable name refers to an instance variable, and a colon-prefixed +function name refers to a method. The sub-sections below provide +detailed examples. -Note that the Next resolvers can be used in the XOTcl 2.* environment as well. +Note that the resolvers of the Next Scripting Framework can be used in +the XOTcl 2.* environment as well. - ==== Invoking Methods + +In XOTcl, a method of the same object can be invoked via +my+, or in +general via using the name of the object in front of the method name. + +In NX, the own methods are called via the method name prefixed with a +single colon. The invocation of the methods of other objects is the +same in NX and XOTcl. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -534,19 +588,28 @@ In general, the Next Scripting Language favors the access to an objects's own instance variables over variable accesses of other -objects. On the contrary, in XOTcl, the variable access to own and -other variables are completely symmetric. +objects. This means that in NX it is syntactically easier to access +the own instance variables. On the contrary, in XOTcl, the variable +access to own and other variables are fully symmetric. -In Next Scripting, access to local variables are performed via -primarily via name resolvers, but using the standard tcl commands -(like e.g. `set`, `incr`, `append`, `info exists`, etc.). In XOTcl, it -is common to provide same-named methods registered on -`::xotcl::Object` for such purposes. This is one of the reasons, why -the Next Scripting Language has a much smaller interface (less -predefined methods). It is possible for an application program to -register XOTcl-like methods in the Next Scripting Language via the -primitives of the Next Scripting Framework. +In XOTcl, the following approaches are used to access instance +variables: +- Import instance variables via +instvar+ and access variables via +$varName+ +- Set or get instance variables via +my set varName ?value?+ or other + variable accessing methods registered on +xotcl::Object+ such as + +append+, +lappend+, +incr+, etc. +- Register same-named accessor functions and set/get values + of instance variables via +my varName ?value?+ + +In NX, the favored approach to access instance variables is to use +the name resolvers, although it is as well possible to import +variables via +nx::var import+ or to check for the existence of +instance variables via +nx::var exists+. + +The following examples summary the use cases for accessing the own and +other instance variables. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -752,6 +815,41 @@ |[source,tcl] ---------------- +# Parameters only available at class level + +Class C \ + -parameter { + x + {y 1} +} +---------------- + +|[source,tcl] +---------------- +# Define object attributes +# (parameters for initializing objects) + +Class create C { + :attribute x + :attribute {y 1} + :class-object attribute oa1 +} + +Object create o { + :attribute oa2 +} +---------------- +[source,tcl] +---------------- +Class create C \ + -attributes { + x + {y 1} +} +---------------- + +|[source,tcl] +---------------- # Object parameter specified via slots Class Foo -slots {