Index: TODO =================================================================== diff -u -r268f85047af3501fc9e1b7798b9f3ec51cac77f7 -r3df933477f01d26d32220be5a1c87bfc0c5b7685 --- TODO (.../TODO) (revision 268f85047af3501fc9e1b7798b9f3ec51cac77f7) +++ TODO (.../TODO) (revision 3df933477f01d26d32220be5a1c87bfc0c5b7685) @@ -2183,6 +2183,14 @@ - "info method definition" for :attributes? +- ".... info methods -methodtype scripted ....." and "info lookup + method -methodtype ..." vs. "info method type ...."; spricht was + dagegen, anstelle von "methodtype" nur "type" zu verwenden? + +- documentation + * migration guide + 3.8. Dispatch, Aliases, etc.: to be done or omitted + - check performance implications of value conflict checker - explizites [::nsf::method delete] (sinngemäss), als ergänzung zum "{} {}"-idiom @@ -2303,6 +2311,7 @@ ==================== For future releases: + * consider alternate method name/place for subcmds (and/or slots) on classes - currently, there are potentail conflicts between slots and ensemble objects - provide a different place in the namesspaces could simplify this Index: doc/next-migration.html =================================================================== diff -u -r268f85047af3501fc9e1b7798b9f3ec51cac77f7 -r3df933477f01d26d32220be5a1c87bfc0c5b7685 --- doc/next-migration.html (.../next-migration.html) (revision 268f85047af3501fc9e1b7798b9f3ec51cac77f7) +++ doc/next-migration.html (.../next-migration.html) (revision 3df933477f01d26d32220be5a1c87bfc0c5b7685) @@ -553,12 +553,33 @@ migration guide from XOTcl 1 to NX, and presents potential incompatibilities beween XOTcl 1.and XOTcl 2

-
-
-
Todo
-

Here comes general text, maybe partly from slides/paper …. TODO: Maybe we -should not refer to ::nsf here, just to ::nx …

-
+

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 +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 +programming. The Next Scripting Frameworks provides C-level support +for defining and hosting multiple object systems in a single Tcl +interpreter. The whole definition of NX is fully scripted +(e.g. defined in nx.tcl). The Next Scripting Framework is shipped +with three language definitions, containing NX and XOTcl 2. Most of +the existing XOTcl 1 programs can be used without modification in the +Next Scripting Framework. The Next Scripting Framework requires Tcl +8.5 or newer.

+

Although NX is fully scripted (as well as XOTcl 2), our benchmarks +show that scripts based on NX are often 2 or 4 times faster than the +counterparts in XOTcl 1. But speed was not the primary focus on the +Next Scripting Environment: The goal was primarily to find ways to +repackage the power of XOTcl in an easy to learn environment, highly +orthogonal environment, which is better suited for large projects, +trying to reduce maintenance costs.

+

We expect that many user will find it attractive to upgrade +from XOTcl 1 to XOTcl 2, and some other users will upgrade to NX. +This document focuses mainly on the differences between XOTcl 1 and +NX, but addresses as well potential incompatibilitied between XOTcl 1 +and XOTcl 2. For an introduction to NX, please consult the NX tutorial.

@@ -569,35 +590,37 @@
+
  • +

    +The naming of the methods in the The Next Scripting Language is much more + in line with the mainstream naming conventions in OO languages. +

    +
  • Below is a small, introductory example showing an implementation of a class Stack in NX and XOTcl. NX supports a block syntax, where the @@ -1843,15 +1872,35 @@

    3.4. Parameters

    -

    While XOTcl 1 had very limited forms of parameters, XOTcl 2 and nx +

    While XOTcl 1 had very limited forms of parameters, XOTcl 2 and NX provide a generalized and highly orthogonal parameter handling with -various kinds of value constraints. We devide the parameters into -Object Parameters (parameters used for initializing objects and -classes) and Method Parameters (parameters passed to -methods). Furthermore, XOTcl 2 and NX support return value checker -based on the same mechanisms.

    +various kinds of value constraints (also called value checker). We +divide the parameters into Object Parameters (parameters used for +initializing objects and classes, specified in XOTcl via the method +parameter) and Method Parameters (parameters passed to +methods). The Next Scripting Framework provide a unified, +C-implemented infrastructure to handle both, object and method +parameters.

    +

    Furthermore, the Next Scripting Framework provides

    +
    +

    based on the same mechanisms.

    3.4.1. Object Parameters

    +

    Object parameters are supported in XOTcl via the method +parameter. Since the term "parameter" is underspecified, NX uses the +term "attribute". To define multiple attributes in a short form, NX +provides the method attributes.

    # Object f1 has a == 0 and b == 1 + +
    +
    +

    In XOTcl the method parameter is a shortcut for creating multiple +slot objects. Slot objects can be as well created in XOTcl directly +via the method slots to provide a much richer set of +meta-data for every attribute.

    +

    To make the definition of attributes more orthogonal, NX uses the +method attribute which can be used as well on the class and on the +object level. When an attribute is created, NX does actually three +things:

    +
      +
    1. +

      +Create a slot object, which can be specified in more detail + using the init-block of the slot object +

      +
    2. +
    3. +

      +Create an object parameter definition for the initialization of the + object (usable via a non-positional parameter during object + creation), and +

      +
    4. +
    5. +

      +register an accessor function (setter), for wich the usual + protection levels (public or protected) can be used. +

      +
    6. +
    +
    + +++ + + + + + + +Class Foo -slots { + Attribute a + Attribute b -default 1 +} + +# Create instance of the class Foo +Foo f1 -a 0 + +# Object f1 has a == 0 and b == 1 + +# Create instance of the class Foo +Foo create f1 -a 0 + +# Object f1 has a == 0 and b == 1 +
    # Parameters only available at class level
    +Objectcreate o { + :attribute oa2 +} + +
    XOTcl Next Scripting Language
    -
    # Parameters only available at class level
    +
    # Object parameter specified via slots
     
    -Class C \
    -   -parameter {
    -    x
    -    {y 1}
    -}
    -
    # Define object attributes
    -# (parameters for initializing objects)
    +
    # Object parameter specified via attribute methods
    +# (allow method modifiers and scripted configuration)
     
    -Class create C {
    -  :attribute x
    -  :attribute {y 1}
    -  :class-object attribute oa1
    +Class create Foo {
    +   :attribute a
    +   :attribute {b 1}
     }
     
    -Object create o {
    -  :attribute oa2
    -}
    -
    -
    -
    Class create C \
    -   -attributes {
    -    x
    -    {y 1}
    -}
    @@ -1967,18 +2053,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 slots
    -
    -Class Foo -slots {
    -   Attribute a
    -   Attribute b -default 1
    -}
    -
    -# Create instance of the class Foo
    -Foo f1 -a 0
    -
    -# Object f1 has a == 0 and b == 1
    -
    -
    # Object parameter specified via attribute methods
    -# (allow method modifieres and scripted configuration)
    +
    # Define object parameter at the class
    +# and object level
     
    -Class create Foo {
    -   :attribute a
    -   :attribute {b 1}
    +Class create C {
    +  :attribute x
    +  :attribute {y 1}
    +  :class-object attribute oa1
     }
     
    -# Create instance of the class Foo
    -Foo create f1 -a 0
    -
    -# Object f1 has a == 0 and b == 1
    @@ -2034,8 +2109,8 @@ .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
    -# specific type checker
    +
    # Object parameter with scripted definition (init-block),
    +# defining an attribute specific type checker
     
     Class create Person {
        :attribute sex {
    @@ -2050,7 +2125,33 @@
        }
     }
    +
    +

    XOTcl 1 did not support value constraints for object parameters (just +for non-positional arguments).

    +

    NX supports value constraints (value-checkers) for object and method +parameters in an orthogonal manner. NX provides a predefined set of +value checkers, which can be extended by the application developer.

    +

    In NX, the value checking is optional. This means that it is possible to +develop e.g. which a large amount of value-checking and deploy the +script with value checking turned off, if the script is highly +performance sensitive.

    +
    + +++ + + + + + + +
    # Value constraints for parameter not available
    + +
    XOTcl Next Scripting Language
    -
    # Predefined value constraints for parameter not available
    # Predefined value constraints:
     #    object, class, alnum, alpha, ascii, boolean, control,
    -#    digit, double, false, graph, integer, lower, print,
    -#    punct,  space, true, upper, wordchar, xdigit
    +#    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.
     #
     # Define a boolean attribute and an integer attribute with a
    -# default
    +# default firstly via "attributes", then with multiple
    +# "attribute"  statements.
     
     Class create Foo -attributes {
        a:boolean
    @@ -2099,7 +2201,30 @@
        :attribute {b:integer 1}
     }
    +
    +

    In XOTcl all object parameters were optional. Required parameters have +to be passed to the constructor of the object.

    +

    NX allows to define optional and required object +attributes. Therefore, object parameters can be used as the single +mechanism to parameterize objects. The constructors do not require any +parameters.

    +
    + +++ + + + + + + @@ -2191,8 +2338,8 @@

    3.4.2. Method Parameters

    The method parameters specifications in XOTcl 1 were limited and -allowed only value constraints for non positional arguments. NX and -XOTcl 2 provide value constraints for all kind of method parameters. +allowed only value constraints for non positional arguments.

    +

    NX and XOTcl 2 provide value constraints for all kind of method parameters. While XOTcl 1 required non-positional arguments to be listed in front of positional arguments, this limitation is lifted in XOTcl 2.

    @@ -2273,13 +2420,13 @@ # trailing (or interleaved) non-positional parameters :public method m1 {a b -x:integer -y} {....} - # postional parameters with value constraints + # positional parameters with value constraints :public method m2 {a:integer b:boolean} {....} - # optional postional parameter (trailing) + # optional positional parameter (trailing) :public method set {varName value:optional} {....} - # parameter with multiplicty + # parameter with multiplicity :public method m3 {-objs:object,1..n c:class,0..1} {....} # In general, the same list of value constraints as for @@ -2294,12 +2441,12 @@
    -

    3.4.3. Return Value Checkers

    -

    Return value checker are a functionality that was not yet available in +

    3.4.3. Return Value Checking

    +

    Return value checking is a functionality that was not yet available in XOTcl 1. A return value checker assures that a method returns always a -parameter of a certain value. Return value checkers can be defined on -all forms of methods. Like for other value checkers, return -value checkers can be turned on and off.

    +value satisfying some value constraints. Return value checkers can be defined on +all forms of methods (scripted or C-implemented). Like for other value +checkers, return value checkers can be turned on and off.

    XOTcl Next Scripting Language
    Class create Foo {
       :attribute {ints:integer,0..n ""}
    -   :attribute objs:object,1..n
    -   :attribute obj:object,0..1
    +  :attribute objs:object,1..n
    +  :attribute obj:object,0..1
     }

    3.5. Interceptors

    +

    XOTcl and NX allow the definition of the same set of interceptors, +namely class- and object-level mixins and class- and object-level +filters. The primary difference in NX is the naming, since NX +abandons the prefix "inst" from the method names.

    +

    Therefore, in NX, if a mixin is registered on the class-level, it is +a per-class mixin, if the mixin is registered on the object level, +it is a object-level mixin. In both cases, the method mixin is used. +If a mixin is registered on the class object, one has to use the +modifier class-object (in the same way as e.g. for defining methods).

    3.5.1. Register Mixin Classes and Mixin Guards

    @@ -2561,8 +2717,21 @@

    3.6. Introspection

    +

    In general, introspection in NX became more orthogonal and less +dependent on the type of the method. In XOTcl it was e.g. necessary +that a developer had to know, whether a method is e.g. scripted or not +and has to use accordingly different sub-methods of info.

    +

    In NX, one can use e.g. always info method with a subcommand and the +framework tries to hide the differences as far as possible. So, one +can for example obtain with info method parameter the parameters of +scripted and C-implemented methods the same way. In addition, NX +provides means to query the type of a method.

    -

    3.6.1. List methods defined by objects

    +

    3.6.1. List methods defined by classes

    +

    While XOTcl uses different names for obtaining different kinds of +methods defined by a class, NX uses info methods in an orthogonal +manner. NX allows as well to use the call protection to filter the +returned methods.

    -
    /obj/ info commands ?pattern?
    +
    /cls/ info instcommands ?pattern?
    +
    /cls/ info methods ?pattern?
    +
    /cls/ info instparametercmd ?pattern?
    +
    /cls/ info methods -methodtype setter ?pattern?
    +
    /cls/ info instprocs ?pattern?
    +
    /cls/ info methods -methodtype scripted ?pattern?
    +
    /cls/ info methods -methodtype alias ?pattern?
    +
    /cls/ info methods -methodtype forwarder ?pattern?
    +
    /cls/ info methods -methodtype object ?pattern?
    +
    /cls/ info methods -callprotection public|protected ...
    -
    /obj/ info methods ?pattern?
    @@ -2609,7 +2778,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 methods -methodtype setter ?pattern?
    @@ -2631,7 +2800,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 methods -methodtype scripted ?pattern?
    @@ -2663,7 +2832,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /obj/ info methods -methodtype alias ?pattern?
    @@ -2685,7 +2854,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /obj/ info methods -methodtype forwarder ?pattern?
    @@ -2707,7 +2876,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /obj/ info methods -methodtype object ?pattern?
    @@ -2729,14 +2898,18 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /obj/ info methods -callprotection public|protected ...
    -

    3.6.2. List methods defined by classes

    +

    3.6.2. List methods defined by objects

    +

    While XOTcl uses different names for obtaining different kinds of +methods defined by an object, NX uses info methods in an orthogonal +manner. NX allows as well to use the call protection to filter the +returned methods.

    -
    /cls/ info instcommands ?pattern?
    +
    /obj/ info commands ?pattern?
    +
    /obj/ info methods ?pattern?
    +
    /obj/ info parametercmd ?pattern?
    +
    /obj/ info methods -methodtype setter ?pattern?
    +
    /obj/ info procs ?pattern?
    +
    /obj/ info methods -methodtype scripted ?pattern?
    +
    /obj/ info methods -methodtype alias ?pattern?
    +
    /obj/ info methods -methodtype forwarder ?pattern?
    +
    /obj/ info methods -methodtype object ?pattern?
    +
    /obj/ info methods -callprotection public|protected ...
    -
    /cls/ info methods ?pattern?
    @@ -2783,7 +2956,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 methods -methodtype setter ?pattern?
    @@ -2805,7 +2978,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 methods -methodtype scripted ?pattern?
    @@ -2837,7 +3010,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /cls/ info methods -methodtype alias ?pattern?
    @@ -2859,7 +3032,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /cls/ info methods -methodtype forwarder ?pattern?
    @@ -2881,7 +3054,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /cls/ info methods -methodtype object ?pattern?
    @@ -2903,14 +3076,17 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /cls/ info methods -callprotection public|protected ...

    3.6.3. List class object specific methods

    +

    When class-object specific properties are queried, NX required to use +the modifier class-object (like for the definition of the methods). +In all other respects, this section is identical to the previous one.

    3.6.4. List callable methods

    +

    In order to obtain for an object the set of artefacts defined in the + class hierarchy, NX uses info lookup. One can either lookup methods + (via info lookup methods) or slots (via info lookup slots). The + plural term refers to a potential set of return values.

    3.6.5. List object/class where some method is defined

    +

    info lookup can be used as well to determine, where exactly an + artefact is located. One can obtain this way a method handle, where +a method or filter is defined.

    +

    The concept of a method-handle is new in NX. The method-handle +can be used to obtain more information about the method, such as +e.g. the definition of the method.

    3.6.6. List definition of scripted methods defined by classes

    +

    XOTcl contains a long list of info subcommands for different kinds of +methods and for obtaining more detailed information about these +methods.

    +

    In NX, this list of info subcommands is much shorter and more +orthogonal. For example info method definition can be used to obtain +with a single command the full definition of a scripted method, and +furthermore, it works as well the same way to obtain e.g. the +definition of a forwarder or an alias.

    +

    Another powerful introspection option in NX is info method +parametersyntax which obtains a representation of the parameters of a +method in the style of Tcl man pages (regardless of the kind of +method).

    +
    # n.a.
    + + + + +
    # not needed, part of "info method parameter"
    +
    /cls/ info method parametersyntax /methodName/
    +
    +
    /cls/ info method definition /methodName/
    +
    /cls/ info instbody /methodName/
    -
    /cls/ info instdefault /methodName/
    @@ -3439,14 +3659,16 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /cls/ info method definition /methodName/

    3.6.7. List definition of scripted object specific methods

    +

    While XOTcl uses different names for info options for objects and +classes (using the prefix "inst"), the names in NX are the same.

    -
    /obj/ info body /methodName/
    +
    # n.a.
    +
    /obj/ info method definition /methodName/
    +
    /obj/ info body /methodName/
    +
    /obj/ info method body /methodName/
    +
    /obj/ info args /methodName/
    +
    /obj/ info method args /methodName/
    +
    /obj/ info nonposargs /methodName/
    +
    /obj/ info default /methodName/
    +
    # not needed, part of "info method parameter"
    +
    /obj/ info method postcondition /methodName/
    +
    /obj/ info method parametersyntax /methodName/
    -
    /obj/ info method body /methodName/
    @@ -3493,7 +3715,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 method args /methodName/
    @@ -3515,7 +3737,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 method parameter /methodName/
    @@ -3537,7 +3759,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 pre /methodName/
    -
    /obj/ info method precondition /methodName/
    @@ -3613,7 +3835,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/
    @@ -3635,15 +3857,20 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    /obj/ info method definition /methodName/
    -

    For definition of class object specific methods, use modifier class-object as shown in examples above.

    +

    For definition of class object specific methods, use the modifier +class-object as shown in examples above.

    3.6.8. List Filter or Mixins

    +

    In NX all introspection options for filters are grouped under info +filter and all introspection options for mixins are under info +mixin. Therefore, NX follows here the approach of using hierarchical +subcommands rather than using a flat namespace.

    3.6.9. List definition of methods defined by aliases, setters or forwarders

    +

    As mentioned earlier, +info method definition" can be used on every +kind of method.

    -

    3.6.10. List fully qualified name of method

    +

    3.6.10. List Method-Handles

    +

    NX supports method-handles to provide means to obtain further +information about a method or to change maybe some properties of a +method. When a method is created, the method creating method returns +the method handle to the created method.

    3.6.11. List type of a method

    +

    The method info method type is new in NX to obtain the type of the +specified method.

    3.6.12. List the scope of mixin classes

    +

    NX provides a richer set of introspection options to obtain +information, where mixins classes are mixed into.

    3.6.13. Check properties of object and classes

    +

    Similar as noted before, NX uses rather a hierarchical approach of +naming using multiple layers of subcommands).

    3.6.14. Call-stack Introspection

    +

    Call-stack introspection is very similar in NX and XOTcl. NX uses for +subcommand the term current instead of self, since self has a +strong connotation to the current object. The term proc is renamed +by method.

    -
    current
    +
    self
    -
    current object
    +
    current object
    +
    current class
    +
    current method
    +
    current currentclass
    +
    current callingobject
    +
    current callingmethod
    +
    current calledclass
    +
    current calledmethod
    +
    current isnextcall
    +currentnext +current filterreg +
    current callinglevel
    +
    current activelevel
    @@ -4444,7 +4687,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current class
    @@ -4466,7 +4709,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current method
    @@ -4488,7 +4731,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current currentclass
    @@ -4510,7 +4753,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current callingobject
    @@ -4532,7 +4775,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current callingmethod
    @@ -4554,7 +4797,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current calledclass
    @@ -4576,7 +4819,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current calledmethod
    @@ -4598,7 +4841,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current isnextcall
    @@ -4621,7 +4864,7 @@ .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;}
    # Returns method-handle
    -current next
    @@ -4644,7 +4887,7 @@ .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;}
    # Returns method-handle
    -current filterreg
    @@ -4666,7 +4909,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current callinglevel
    @@ -4688,7 +4931,7 @@ .nx-placeholder {color: #AF663F; font-weight: normal; font-style: italic;} .nx-variable {color: #AF663F; font-weight: normal; font-style: normal;} -
    current activelevel
    @@ -4733,6 +4976,28 @@
    /obj/ require namespace
    + +
    +
    +
    # n.a.
    +
    +
    +
    /obj/ require method
    + @@ -4743,6 +5008,9 @@

    3.9. Assertions

    +

    In contrary to XOTcl, NX provides no pre-registered methods for +assertion handling. All assertion handling can e performed via the +Next Scripting primitive nsf::assertion.

    Index: doc/next-migration.txt =================================================================== diff -u -r268f85047af3501fc9e1b7798b9f3ec51cac77f7 -r3df933477f01d26d32220be5a1c87bfc0c5b7685 --- doc/next-migration.txt (.../next-migration.txt) (revision 268f85047af3501fc9e1b7798b9f3ec51cac77f7) +++ doc/next-migration.txt (.../next-migration.txt) (revision 3df933477f01d26d32220be5a1c87bfc0c5b7685) @@ -17,40 +17,65 @@ 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 +many developers are involved. -.Todo -***************************************************************************** -Here comes general text, maybe partly from slides/paper .... TODO: Maybe we -should not refer to ::nsf here, just to ::nx ... -***************************************************************************** +The Next Scripting Language is based on the Next Scripting Framework +which was developed based on the notion of language oriented +programming. The Next Scripting Frameworks provides C-level support +for defining and hosting multiple object systems in a single Tcl +interpreter. The whole definition of NX is fully scripted +(e.g. defined in +nx.tcl+). The Next Scripting Framework is shipped +with three language definitions, containing NX and XOTcl 2. Most of +the existing XOTcl 1 programs can be used without modification in the +Next Scripting Framework. The Next Scripting Framework requires Tcl +8.5 or newer. +Although NX is fully scripted (as well as XOTcl 2), our benchmarks +show that scripts based on NX are often 2 or 4 times faster than the +counterparts in XOTcl 1. But speed was not the primary focus on the +Next Scripting Environment: The goal was primarily to find ways to +repackage the power of XOTcl in an easy to learn environment, highly +orthogonal environment, which is better suited for large projects, +trying to reduce maintenance costs. +We expect that many user will find it attractive to upgrade +from XOTcl 1 to XOTcl 2, and some other users will upgrade to NX. +This document focuses mainly on the differences between XOTcl 1 and +NX, but addresses as well potential incompatibilitied between XOTcl 1 +and XOTcl 2. For an introduction to NX, please consult the NX tutorial. + Differences Between XOTcl and NX ------------------------------- In general, the Next Scripting Language (NX) differs from XOTcl in the following respects: -- The Next Scripting Language favors a _stronger form of encapsulation_ - than XOTcl. Calling the own methods or accessing the - own instance variables is typographically easier and - computationally faster than these operations on other objects. This - behavior is achieved via resolvers an makes the definition of - methods necessary in XOTcl obsolete. On the other hand, XOTcl is - complete symmetrical in this respect. +- The Next Scripting Language favors a _stronger form of + encapsulation_ than XOTcl. Calling the own methods or accessing the + own instance variables is typographically easier and computationally + faster than these operations on other objects. This behavior is + achieved via resolversm which make some methods necessary in XOTcl + obsolete in NX (especially for importing instance variables). On the + other hand, XOTcl is complete symmetrical in this respect. -- The encapsulation of Next Scripting is still weak compared to - languages like C++; a developer can still access e.g. other - variables via some idioms, but this _makes accesses to other - objects variables explicit_ and requires more typing - effort. Through the weak encapsulation a programmer should be - encouraged to implement methods to provide access to instance +- The encapsulation of Next Scripting is stronger than in XOTcl but + still weak compared to languages like C++; a developer can still + access e.g. other variables via some idioms, but this _makes + accesses to other objects variables explicit_ and requires more + typing effort. Through the weak encapsulation a programmer should + be encouraged to implement methods to provide access to instance variables. -- The Next Scripting Language provides means of _method protection_. +- The Next Scripting Language provides means of _method + protection_. Therefore developers have to define interfaces in order + to use methods from other objects. - The Next Scripting Language provides _scripted init blocks_ for - objects and classes (replacement for the somewhat dangerous dash "-" + objects and classes (replacement for the dangerous dash "-" mechanism in XOTcl that allows to set variables and invoke methods upon object creation). @@ -80,6 +105,9 @@ Info methods for Objects: :: 25 Info method for Classes: :: 24 +- The naming of the methods in the The Next Scripting Language is much more + in line with the mainstream naming conventions in OO languages. + 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 @@ -487,7 +515,6 @@ 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 @@ -774,16 +801,30 @@ === Parameters -While XOTcl 1 had very limited forms of parameters, XOTcl 2 and nx +While XOTcl 1 had very limited forms of parameters, XOTcl 2 and NX provide a generalized and highly orthogonal parameter handling with -various kinds of value constraints. We devide the parameters into -_Object Parameters_ (parameters used for initializing objects and -classes) and _Method Parameters_ (parameters passed to -methods). Furthermore, XOTcl 2 and NX support return value checker +various kinds of value constraints (also called value checker). We +divide the parameters into _Object Parameters_ (parameters used for +initializing objects and classes, specified in XOTcl via the method ++parameter+) and _Method Parameters_ (parameters passed to +methods). The Next Scripting Framework provide a unified, +C-implemented infrastructure to handle both, object and method +parameters. + +Furthermore, the Next Scripting Framework provides + +- unified parameter checking (for object and method parameters) and +- return value checking + based on the same mechanisms. ==== Object Parameters +Object parameters are supported in XOTcl via the method ++parameter+. Since the term "parameter" is underspecified, NX uses the +term "attribute". To define multiple attributes in a short form, NX +provides the method +attributes+. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -812,42 +853,30 @@ # Object f1 has a == 0 and b == 1 ---------------- +|====================== -|[source,tcl] ----------------- -# Parameters only available at class level +In XOTcl the method +parameter+ is a shortcut for creating multiple +slot objects. Slot objects can be as well created in XOTcl directly +via the method +slots+ to provide a much richer set of +meta-data for every attribute. -Class C \ - -parameter { - x - {y 1} -} ----------------- +To make the definition of attributes more orthogonal, NX uses the +method +attribute+ which can be used as well on the class and on the +object level. When an attribute is created, NX does actually three +things: -|[source,tcl] ----------------- -# Define object attributes -# (parameters for initializing objects) +. Create a slot object, which can be specified in more detail + using the init-block of the slot object +. Create an object parameter definition for the initialization of the + object (usable via a non-positional parameter during object + creation), and +. register an accessor function (setter), for wich the usual + protection levels (+public+ or +protected+) can be used. -Class create C { - :attribute x - :attribute {y 1} - :class-object attribute oa1 -} +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language -Object create o { - :attribute oa2 -} ----------------- -[source,tcl] ----------------- -Class create C \ - -attributes { - x - {y 1} -} ----------------- - |[source,tcl] ---------------- # Object parameter specified via slots @@ -867,7 +896,7 @@ |[source,tcl] ---------------- # Object parameter specified via attribute methods -# (allow method modifieres and scripted configuration) +# (allow method modifiers and scripted configuration) Class create Foo { :attribute a @@ -879,8 +908,31 @@ # Object f1 has a == 0 and b == 1 ---------------- + + |[source,tcl] ---------------- +# Parameters only available at class level +---------------- + +|[source,tcl] +---------------- +# Define object parameter at the class +# and object level + +Class create C { + :attribute x + :attribute {y 1} + :class-object attribute oa1 +} + +Object create o { + :attribute oa2 +} +---------------- + +|[source,tcl] +---------------- # Object parameter with configured slot, defining an attribute # specific type checker @@ -898,8 +950,8 @@ ---------------- |[source,tcl] ---------------- -# Object parameter with scripted definition, defining an attribute -# specific type checker +# Object parameter with scripted definition (init-block), +# defining an attribute specific type checker Class create Person { :attribute sex { @@ -914,22 +966,41 @@ } } ---------------- +|====================== + +XOTcl 1 did not support value constraints for object parameters (just +for non-positional arguments). + +NX supports _value constraints_ (value-checkers) for object and method +parameters in an orthogonal manner. NX provides a predefined set of +value checkers, which can be extended by the application developer. + +In NX, the _value checking is optional_. This means that it is possible to +develop e.g. which a large amount of value-checking and deploy the +script with value checking turned off, if the script is highly +performance sensitive. + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + |[source,tcl] ---------------- -# Predefined 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, print, -# punct, space, true, upper, wordchar, xdigit +# 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. # # Define a boolean attribute and an integer attribute with a -# default +# default firstly via "attributes", then with multiple +# "attribute" statements. Class create Foo -attributes { a:boolean @@ -943,6 +1014,20 @@ :attribute {b:integer 1} } ---------------- +|====================== + +In XOTcl all object parameters were _optional_. Required parameters have +to be passed to the constructor of the object. + +NX allows to define _optional_ and _required_ object +attributes. Therefore, object parameters can be used as the single +mechanism to parameterize objects. The constructors do not require any +parameters. + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + |[source,tcl] ---------------- # Required parameter not available @@ -966,6 +1051,18 @@ :attribute b:boolean,required } ---------------- +|====================== + +NX supports in contrary to XOTcl to define the _multiplicity_ of values +per parameter. In NX, one can specify that a parameter can accept the +value "" (empty) in addition to e.g. an integer, or one can specify that the +value is an empty or non-empty ist of values via the multiplicity. For +every specified value, the value checkers are applied. + +[options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] +|====================== +|XOTcl |Next Scripting Language + |[source,tcl] --------------- # Multiplicity for parameter not available @@ -984,17 +1081,18 @@ ---------------- Class create Foo { :attribute {ints:integer,0..n ""} - :attribute objs:object,1..n - :attribute obj:object,0..1 + :attribute objs:object,1..n + :attribute obj:object,0..1 } ---------------- |====================== ==== Method Parameters The method parameters specifications in XOTcl 1 were limited and -allowed only value constraints for non positional arguments. NX and -XOTcl 2 provide value constraints for all kind of method parameters. +allowed only value constraints for non positional arguments. + +NX and XOTcl 2 provide value constraints for all kind of method parameters. While XOTcl 1 required non-positional arguments to be listed in front of positional arguments, this limitation is lifted in XOTcl 2. @@ -1039,13 +1137,13 @@ # trailing (or interleaved) non-positional parameters :public method m1 {a b -x:integer -y} {....} - # postional parameters with value constraints + # positional parameters with value constraints :public method m2 {a:integer b:boolean} {....} - # optional postional parameter (trailing) + # optional positional parameter (trailing) :public method set {varName value:optional} {....} - # parameter with multiplicty + # parameter with multiplicity :public method m3 {-objs:object,1..n c:class,0..1} {....} # In general, the same list of value constraints as for @@ -1057,13 +1155,13 @@ ---------------- |====================== -==== Return Value Checkers +==== Return Value Checking -Return value checker are a functionality that was not yet available in +_Return value checking_ is a functionality that was not yet available in XOTcl 1. A return value checker assures that a method returns always a -parameter of a certain value. Return value checkers can be defined on -all forms of methods. Like for other value checkers, return -value checkers can be turned on and off. +value satisfying some value constraints. Return value checkers can be defined on +all forms of methods (scripted or C-implemented). Like for other value +checkers, return value checkers can be turned on and off. [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== @@ -1102,6 +1200,17 @@ === Interceptors +XOTcl and NX allow the definition of the same set of interceptors, +namely class- and object-level mixins and class- and object-level +filters. The primary difference in NX is the naming, since NX +abandons the prefix "inst" from the method names. + +Therefore, in NX, if a +mixin+ is registered on the class-level, it is +a per-class mixin, if the +mixin+ is registered on the object level, +it is a object-level mixin. In both cases, the method +mixin+ is used. +If a mixin is registered on the class object, one has to use the +modifier +class-object+ (in the same way as e.g. for defining methods). + ==== Register Mixin Classes and Mixin Guards [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] @@ -1190,135 +1299,162 @@ |====================== === Introspection -==== List methods defined by objects + +In general, introspection in NX became more orthogonal and less +dependent on the type of the method. In XOTcl it was e.g. necessary +that a developer had to know, whether a method is e.g. scripted or not +and has to use accordingly different sub-methods of +info+. + +In NX, one can use e.g. always +info method+ with a subcommand and the +framework tries to hide the differences as far as possible. So, one +can for example obtain with +info method parameter+ the parameters of +scripted and C-implemented methods the same way. In addition, NX +provides means to query the type of a method. + +==== List methods defined by classes + +While XOTcl uses different names for obtaining different kinds of +methods defined by a class, NX uses +info methods+ in an orthogonal +manner. NX allows as well to use the call protection to filter the +returned methods. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- -/obj/ info commands ?pattern? +/cls/ info instcommands ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info methods ?pattern? +/cls/ info methods ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info parametercmd ?pattern? +/cls/ info instparametercmd ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype setter ?pattern? +/cls/ info methods -methodtype setter ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info procs ?pattern? +/cls/ info instprocs ?pattern? ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype scripted ?pattern? +/cls/ info methods -methodtype scripted ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype alias ?pattern? +/cls/ info methods -methodtype alias ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype forwarder ?pattern? +/cls/ info methods -methodtype forwarder ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/obj/ info methods -methodtype object ?pattern? +/cls/ info methods -methodtype object ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/obj/ info methods -callprotection public\|protected ... +/cls/ info methods -callprotection public\|protected ... ---------------- |====================== -==== List methods defined by classes +==== List methods defined by objects +While XOTcl uses different names for obtaining different kinds of +methods defined by an object, NX uses +info methods+ in an orthogonal +manner. NX allows as well to use the call protection to filter the +returned methods. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- -/cls/ info instcommands ?pattern? +/obj/ info commands ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info methods ?pattern? +/obj/ info methods ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info instparametercmd ?pattern? +/obj/ info parametercmd ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype setter ?pattern? +/obj/ info methods -methodtype setter ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info instprocs ?pattern? +/obj/ info procs ?pattern? ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype scripted ?pattern? +/obj/ info methods -methodtype scripted ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype alias ?pattern? +/obj/ info methods -methodtype alias ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype forwarder ?pattern? +/obj/ info methods -methodtype forwarder ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/cls/ info methods -methodtype object ?pattern? +/obj/ info methods -methodtype object ?pattern? ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/cls/ info methods -callprotection public\|protected ... +/obj/ info methods -callprotection public\|protected ... ---------------- |====================== ==== List class object specific methods +When class-object specific properties are queried, NX required to use +the modifier +class-object+ (like for the definition of the methods). +In all other respects, this section is identical to the previous one. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1383,6 +1519,11 @@ ==== List callable methods +In order to obtain for an object the set of artefacts defined in the + class hierarchy, NX uses +info lookup+. One can either lookup methods + (via +info lookup methods+) or slots (via +info lookup slots+). The + plural term refers to a potential set of return values. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1437,6 +1578,14 @@ ==== List object/class where some method is defined ++info lookup+ can be used as well to determine, where exactly an + artefact is located. One can obtain this way a method handle, where +a method or filter is defined. + +The concept of a _method-handle_ is new in NX. The method-handle +can be used to obtain more information about the method, such as +e.g. the definition of the method. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1463,12 +1612,35 @@ ==== List definition of scripted methods defined by classes +XOTcl contains a long list of +info+ subcommands for different kinds of +methods and for obtaining more detailed information about these +methods. + +In NX, this list of +info+ subcommands is much shorter and more +orthogonal. For example +info method definition+ can be used to obtain +with a single command the full definition of a _scripted method_, and +furthermore, it works as well the same way to obtain e.g. the +definition of a _forwarder_ or an _alias_. + +Another powerful introspection option in NX is +info method +parametersyntax+ which obtains a representation of the parameters of a +method in the style of Tcl man pages (regardless of the kind of +method). + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- +# n.a. +---------------- +|[source,tcl] +---------------- +/cls/ info method definition /methodName/ +---------------- +|[source,tcl] +---------------- /cls/ info instbody /methodName/ ---------------- |[source,tcl] @@ -1497,7 +1669,7 @@ ---------------- |[source,tcl] ---------------- -/cls/ info instdefault /methodName/ +# not needed, part of "info method parameter" ---------------- |[source,tcl] ---------------- @@ -1521,18 +1693,29 @@ ---------------- |[source,tcl] ---------------- -/cls/ info method definition /methodName/ +/cls/ info method parametersyntax /methodName/ ---------------- |====================== ==== List definition of scripted object specific methods +While XOTcl uses different names for info options for objects and +classes (using the prefix "inst"), the names in NX are the same. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language |[source,tcl] ---------------- +# n.a. +---------------- +|[source,tcl] +---------------- +/obj/ info method definition /methodName/ +---------------- +|[source,tcl] +---------------- /obj/ info body /methodName/ ---------------- |[source,tcl] @@ -1561,7 +1744,7 @@ ----------------- |[source,tcl] ---------------- -/obj/ info method parameter /methodName/ +# not needed, part of "info method parameter" ---------------- |[source,tcl] ---------------- @@ -1573,34 +1756,32 @@ ---------------- |[source,tcl] ---------------- -/obj/ info pre /methodName/ ----------------- -|[source,tcl] ----------------- -/obj/ info method precondition /methodName/ ----------------- -|[source,tcl] ----------------- /obj/ info post /methodName/ ---------------- |[source,tcl] ---------------- -/obj/ info post /methodName/ +/obj/ info method postcondition /methodName/ ---------------- |[source,tcl] ---------------- # n.a. ---------------- |[source,tcl] ---------------- -/obj/ info method definition /methodName/ +/obj/ info method parametersyntax /methodName/ ---------------- |====================== -For definition of class object specific methods, use modifier `class-object` as shown in examples above. +For definition of class object specific methods, use the modifier ++class-object+ as shown in examples above. ==== List Filter or Mixins +In NX all introspection options for filters are grouped under +info +filter+ and all introspection options for mixins are under +info +mixin+. Therefore, NX follows here the approach of using hierarchical +subcommands rather than using a flat namespace. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1708,6 +1889,9 @@ ==== List definition of methods defined by aliases, setters or forwarders +As mentioned earlier, +info method definition" can be used on every +kind of method. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1731,8 +1915,13 @@ |====================== -==== List fully qualified name of method +==== List Method-Handles +NX supports _method-handles_ to provide means to obtain further +information about a method or to change maybe some properties of a +method. When a method is created, the method creating method returns +the method handle to the created method. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1757,6 +1946,9 @@ ==== List type of a method +The method +info method type+ is new in NX to obtain the type of the +specified method. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1781,6 +1973,9 @@ ==== List the scope of mixin classes +NX provides a richer set of introspection options to obtain +information, where mixins classes are mixed into. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1824,6 +2019,9 @@ ==== Check properties of object and classes +Similar as noted before, NX uses rather a hierarchical approach of +naming using multiple layers of subcommands). + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1880,6 +2078,11 @@ ==== Call-stack Introspection +Call-stack introspection is very similar in NX and XOTcl. NX uses for +subcommand the term +current+ instead of +self+, since +self+ has a +strong connotation to the current object. The term +proc+ is renamed +by +method+. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language @@ -1890,7 +2093,7 @@ ---------------- |[source,tcl] ---------------- -current +self ---------------- [source,tcl] ---------------- @@ -2011,6 +2214,14 @@ ---------------- /obj/ require namespace ---------------- +|[source,tcl] +---------------- +# n.a. +---------------- +|[source,tcl] +---------------- +/obj/ require method +---------------- |====================== @@ -2019,6 +2230,10 @@ === Assertions +In contrary to XOTcl, NX provides no pre-registered methods for +assertion handling. All assertion handling can e performed via the +Next Scripting primitive +nsf::assertion+. + [options="header",cols="asciidoc,asciidoc",frame="none",valign="middle"] |====================== |XOTcl |Next Scripting Language Index: library/lib/doc-tools.tcl =================================================================== diff -u -rf60d445f73acb4b434f41c990c0469b3252c44c5 -r3df933477f01d26d32220be5a1c87bfc0c5b7685 --- library/lib/doc-tools.tcl (.../doc-tools.tcl) (revision f60d445f73acb4b434f41c990c0469b3252c44c5) +++ library/lib/doc-tools.tcl (.../doc-tools.tcl) (revision 3df933477f01d26d32220be5a1c87bfc0c5b7685) @@ -1,6 +1,6 @@ # @package nx::doc # -# Study for documentation classes for Next Scriptint +# Study for documentation classes for the Next Scripting Langauge # # Compared to the "old" @ docmentation effort, this is a rather # light-weight structure based on xotcl 2 (next) language Index: library/lib/pp.tcl =================================================================== diff -u -r6fe7208cd9d9a64258121bb144d2e1e94ca85d1c -r3df933477f01d26d32220be5a1c87bfc0c5b7685 --- library/lib/pp.tcl (.../pp.tcl) (revision 6fe7208cd9d9a64258121bb144d2e1e94ca85d1c) +++ library/lib/pp.tcl (.../pp.tcl) (revision 3df933477f01d26d32220be5a1c87bfc0c5b7685) @@ -97,7 +97,7 @@ package public protected class-object method attribute forward - my next new self + my next new self current create init new destroy alloc dealloc class superclass mixin ::nx::Class nx::Class ::xotcl::Class xotcl::Class Class