Index: TODO =================================================================== diff -u -rd62bca12731d1c7a1a5cf63f950275852c5b05a2 -r61a1c5c9e11a0277be442d98572bae6a3162cf1f --- TODO (.../TODO) (revision d62bca12731d1c7a1a5cf63f950275852c5b05a2) +++ TODO (.../TODO) (revision 61a1c5c9e11a0277be442d98572bae6a3162cf1f) @@ -3601,7 +3601,8 @@ - nsf.c: added error message, when "noleadingdash" is used on non-positional parameters - nsf.c: use same logic for "nonleadingdash" to "value in argument" - - nsf.c: deactivated rudimentary unknown handler for the time being + - nsf.c: deactivated rudimentary unknown handler non nonpos args + for the time being - nx.tcl: added handling of parameter option "noleadingdash" in objectParameterSlots Index: doc/next-tutorial.html =================================================================== diff -u -r6f01a5690062d994d0bb791c599424c2bc1e7bb3 -r61a1c5c9e11a0277be442d98572bae6a3162cf1f --- doc/next-tutorial.html (.../next-tutorial.html) (revision 6f01a5690062d994d0bb791c599424c2bc1e7bb3) +++ doc/next-tutorial.html (.../next-tutorial.html) (revision 61a1c5c9e11a0277be442d98572bae6a3162cf1f) @@ -2342,13 +2342,13 @@ } } -# Method "bar" is on object specific method of "c1" +# Method "bar" is an object specific method of "c1" c1 bar # object-specific method "foo" returns 2 c1 foo -# Method "baz" is on object specific method of "o1" +# Method "baz" is an object specific method of "o1" nx::Object create o1 { :public method baz {} {return 4} } @@ -2359,12 +2359,12 @@

A class method is a method defined on a class, which is only -applicable to the class object itself. The class method is an +applicable to the class object itself. The class method is a per-object method of the class object.

In NX, all classes are objects. Classes are in NX special kind of objects that have e.g. the ability to create instances and to provide -methods to the instances. Classes manage their instances. The general +methods for the instances. Classes manage their instances. The general method set for classes is defined on the meta-classes (more about this later).

The following example defines a public class method bar on class @@ -2438,8 +2438,9 @@

3.5. Ensemble Methods

-

NX provides "ensemble methods", which are similar in concept to Tcl’s -ensemble commands.

+

NX provides "ensemble methods" as a means to structure the method name +space and to group related methods. Ensemble methods are similar in +concept to Tcl’s ensemble commands.

An ensemble method is a form of a hierarchical method consisting of @@ -2497,7 +2498,70 @@

3.6. Method Resolution

-

+

When a method is invoked, the applicable method is searched in the +following order:

+Per-object Mixins -> Per-class Mixins -> Object -> Intrinsic Class Hierarchy +

In the case, no mixins are involved, first the object is searched for +a per-object method with the given name, and then the class hierarchy +of the object. The method can be defined multiple times on the search +path, so some of these method definitions might be shadowed by the +more specific definitions.

+
Listing 31: Method Resolution

+
+
+
  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+
nx::Class create C {
+  :public method foo {} { return "C foo: [next]"}
+}
+
+nx::Class create D -superclass C {
+
+  :public method foo {} { return "D foo: [next]"}
+
+   :create d1 {
+     :public method foo {} { return "d1 foo: [next]"}
+   }
+}
+
+# Invoke the method foo
+d1 foo
+# result: "d1 foo: D foo: C foo: "
+

Consider the example in +foo is invoked on object d1, the per-object method has the highest +precedence and is therefore invoked. The per-object methods shadows +the same-named methods in the class hierarchy, namely the method foo +of class D and the method foo of class C. The shadowed methods +can be still invoked, either via the primitive next or via method +handles (we used already method handles in the section about method +aliases). In the example above, next calls the shadowed method and +add their results to the results of evey method. So, the final result +contains parts from d1, D and C. Note, that the topmost next +in method foo of class C shadows no method foo and simply +returns empty (and not an error message).

3.7. Parameters

@@ -2541,13 +2605,13 @@

If the position of a parameter in the list of formal arguments (e.g. passed to a function) is significant for its meaning, this is a positional parameter. If the meaning of the parameter is independent -of its postion, this is a non-positional parameter. When we call a +of its position, this is a non-positional parameter. When we call a method with positional parameters, the meaning of the parameters (the association with the argument in the argument list of the method) is determined by its position. When we call a method with non-positional parameters, their meaning is determined via a name passed with the argument during invocation.

-
Listing 31: Positional and Non-Positional Method Parameters

+
Listing 32: Positional and Non-Positional Method Parameters