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 {
|
@@ -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 |
+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 ObjectName
-
-Object create 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).
-
+
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;}
-
-
@@ -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;}
-
- |
+
-
-/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;}
-
- |
+
-
-/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;}
-
- |
+
-
-/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;}
-
- |
+
-
-/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?
|
@@ -3147,8 +3132,7 @@
.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;}
-
-
+
|
@@ -3173,8 +3156,7 @@
.nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;}
.nx-variable {color: #AF663F; font-weight: normal; font-style: normal;}
-
-